有的时候博客内容会有变动,首发博客是最新的,其他博客地址可能会未同步,认准
https://blog.zysicyj.top
如果后端接口没有设置 cors (跨域资源共享),可在前端解决跨域问题,在 vue.config.js 中配置代理:
devServer: {
client: {
overlay: false
}
,
historyApiFallback:true,
allowedHosts
:
'all',
port
:
8080,
proxy
:
{
'/api'
:
{
// target:"http://172.29.133.140:8081/api",
// target: 'http://127.0.0.1:8081',
// target: 'http://172.40.236.81:8907',//网关 gqc
target: 'http://172.29.133.135:8081/api',
// target: 'http://172.29.133.137:8081/api',//陆强
//target: 'http://172.29.132.54:8081/api',//吕世建
// target: 'http://172.29.131.100:8081/api',//于勇
//target: 'http://172.29.131.26:8081/api',//双双
// target:"http://172.29.131.26:8081",
// target:"http://172.29.133.135:8080",
pathRewrite
:
{
'^/api'
:
''
}
}
}
}
然后修改 .env 、 .env.development 文件中的下面这行代码,修改后需要重新运行项目:
VUE_APP_API_BASE_URL=/api
本文是原创文章,采用 CC BY-NC-SA 4.0 协议,完整转载请注明来自 小朱
评论
隐私政策
0/500
滚动到此处加载评论...


