文件结构
-dist
-lib
-adapter
-httpadapter
-xhradapter
-axios. js
-buildFullPath. js
-creatError. js
-dispatchRequest. js //发送请求的文件
-enhanceError. js
-interceptorManager. js //拦截器
-mergeConfig. js
-settle. js //promise如何落定
-transformData. js //结果格式化
-cancel
-core
-helper
-axios.js//入口文件
-default.js//默认配置
http部分是nodejs环境下对其他服务端发送请求,xhr是浏览器环境下发送请求的
总结
从语法上来说 axios不是Axios的实例,他是通过creatInstance创建的
从功能上说,axios是Axios的实例,因为axios拥有了Axios的实例,它能当对象使用,但是又有: axios = Axios.prototype.request(),axios也能够当作一个函数来使用