项目一些问题解决
第三方接口跨域在本地vue-cli3脚手架中的vue.config.js中配置以下代码
vue
devServer: {disableHostCheck: true,
proxy: {
'/api': {
target: 'http://www.api.zhuishushenqi.com',
ws: true,
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
},
'/content': {
target: 'http://chapter2.zhuishushenqi.com',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/content': ''
}
}
}
}
复制代码
部署服务器使用nginx配置java
location /api
{
rewrite ^.+api/?(.*)$ /$1 break;
include uwsgi_params;
proxy_pass http://api.zhuishushenqi.com/;
}
location /content
{
proxy_pass http://chapter2.zhuishushenqi.com/;
}
复制代码
打包后路径问题vue.config.js中配置webpack
baseUrl: './'ios