在config文件夹->index.js
proxyTable: {
'/api': {
target: 'http://baidu.com',
pathRewrite: {
'^/api': ''
}
}
}
target为需要进行跨域的地址
在axios中使用
axios.get("/member")
.then((data) => {
return data.data;
})
.then((data) => {
console.log(data);
})
即可取到数据