xios vue 反向代理跨域

 1.config  下面的index.js找到proxytable进行替换

vue跨域

proxyTable: {

     '/api': {  //使用"/api"来代替"http://f.apiplus.c

    target: 'http://www.dajiwuhui.com', //源地址 

    changeOrigin: true, //改变源 

    pathRewrite: { 

      '^/api': 'http://www.dajiwuhui.com' //路径重写 

      } 

  } 

    },
2.安装axios   在命令窗口里面

  先安装! 

npm install axios

然后!

npm install --save axios vue-axios

配置模板!

import Vue from 'vue'import axios from 'axios'import VueAxios from 'vue-axios' Vue.use(VueAxios, axios)
vue跨域
3. 使用

vue跨域

相关文章:

  • 2021-08-23
  • 2021-04-22
  • 2021-10-10
  • 2021-09-05
  • 2022-01-27
  • 2022-01-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-18
  • 2021-12-08
  • 2021-07-26
  • 2021-12-31
  • 2021-09-08
相关资源
相似解决方案