vue接口代理配置
在config/index.js中配置代理接口
配置proxyTable内容,可多个,如:
proxyTable: {
'/api': {
target: 'http://XXXX.com/',接口地址
changeOrigin: true,//是否代理接口,是否跨域
pathRewrite: {//重定向
'^/apt': '/'
}
}
//需要重启服务
访问
axios.get("/api/xxxx", this.$token).then(res => {
console.log(res);
})