項目一些問題解決
第三方接口跨域在本地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