在config下面的index.js中的module.exports下面的dev加入
proxyTable: {
‘/api’: {
target: ‘http://www.baidu.com’, //源地址
changeOrigin: true, //改变源
pathRewrite: {
‘^/api’: ‘http://www.baidu.com’ //路径重写
}
}
},
在使用axiso的这样写:
this.$axios
.get("/api?page=1&size=6&typeId=" + that.typeId)
.then(res => {
if (res.data.status = 200) {
that.serverlist = res.data;
}
})
.catch(function(err) {
console.log(err);
});
就可以了。
vue-cil2.0前端解决跨越问题
最新推荐文章于 2020-11-25 11:16:28 发布