没安装axios请先安装

Using npm:

 

       $ npm install axios
 

Using bower:

 

      $ bower install axios
 

Using yarn:

 

      $ yarn add axios
 

Using cdn:

 

     <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
 

1、首先自己新建一个axios文件夹用于存放请求和响应拦截器

vue项目中封装axios的请求拦截器和响应拦截器

 

 

vue项目中封装axios的请求拦截器和响应拦截器

2、在main.js中引入axios然后将其挂载到原型链上。

vue项目中封装axios的请求拦截器和响应拦截器

 

相关文章:

  • 2022-12-23
  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案