3-vue-cli中配置跨域

将config下面的index.js中的proxyTable:{}内替换下面即可

 proxyTable: {
      '/': {
        target: 'http://localhost:8083', //自行更改
        changeOrigin: true,
        pathRewrite: {
          '^/': ''
        }
      }
    }

更改配置文件就要重新启动项目才能生效。

原文地址:https://www.cnblogs.com/gfbzs/p/12336948.html