1、在config文件夹下新建文件proxyConfig.js,代码如下
module.exports = {
proxy: {
'/': { //将www.exaple.com印射为/apis
target: 'http:/localhost:8080', // 接口域名
secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, //是否跨域
pathRewrite: {
'^': '' //需要rewrite的,
}
}
}
}
2、在config文件夹下的index.js中引入,截图如下

配置代理解决跨域问题
412

被折叠的 条评论
为什么被折叠?



