1.axios的引入方式:github网址:https://github.com/axios/axios#features
2.可以输入以下代码查看axios的基本配置
console.log(axios)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.27.2/axios.min.js"></script> </head> <body> <script> console.log(axios); </script> </body> </html>
控制台输出:
ƒ (){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)} all: ƒ (e){return Promise.all(e)} arguments: ƒ () Axios: ƒ l(e){this.defaults=e,this.interceptors={request:new i,response:new i}} AxiosError: ƒ o(e,t,n,r,o){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)} caller: ƒ ()
3.如果觉得引用外网的script标签其运行速度较慢,可以在bootCDN当中输入axios,得到加速服务的网址