• 首先安装axios
npm install axios
  • 其次在config下的index.js中修改proxyTable
     
    proxyTable: {
      '/api': {
        target:'http://127.0.0.1:8000', 
        // secure: false, // 如果是https接口,需要配置这个参数
        changeOrigin:true,
        pathRewrite:{
          '^/api': ''
        }
      }
    },
  • 最后在main.js中将其注册(注意除了修改src中的文件外,都需要重启npm)
import axios from 'axios'


Vue.prototype.axios = axios

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-06-26
猜你喜欢
  • 2022-12-23
  • 2021-08-17
  • 2022-01-07
  • 2022-12-23
  • 2021-06-29
  • 2021-12-31
  • 2022-12-23
相关资源
相似解决方案