proxy解决跨域
解决步骤:打开Vue项目,然后在项目中找到config文件夹里面的index.js文件,然后找到proxyTable,然后添加以下代码段即可:
proxyTable: {
['/java/mgr-auth']: { //替换代理地址名称
target: 'http://dev-cloud.bc.com/mgr-auth', //代理地址
changeOrigin: true, //可否跨域
pathRewrite: {
['^/java/mgr-auth']: '', //重写接口,去掉/java/mgr-auth
}
}
}
本文来自博客园,作者:小陈编程记,转载请注明原文链接:https://www.cnblogs.com/walmt/