vue2.x本地开发配置代理
1、关上我的项目中config -> index.js文件
2、批改proxyTable中的内容
proxyTable: { "/service-core": { // 把 localhost:8080 代理为上面的地址 target: "https://test.eastgrain.cn", // localhost:8080代理为这个地址 secure: true, // 如果是https,须要配置true changeOrigin: true, // 是否跨域 // pathRewrite: { // 重写,如果开发环境地址中不须要service-core,那么能够将其重写为'' // "^/service-core": "" // } } // 想要代理的地址:'localhost:8080/service-core/wechat/serviceAccount/qrCode/create' // 代理后的地址 'https://test.eastgrain.cn/service-core/wechat/serviceAccount/qrCode/create' // axios 申请接口写法 axios.get('/service-core/wechat/serviceAccount/qrCode/create')...}
依照下面的办法能够配置多个代理。