在vue.config.js中,設定
module.exports = {
publicPath: '/app',
devServer: {
proxy: {
'/test': {
target: 'http://localhost:88',
ws: true,
changeOrigin: true,
pathRewrite: {
'^/test': '/', // rewrite path
},
}
}
}
}
axios中
this.axios.post('/test').then(value =https://www.cnblogs.com/ztgzlu/p/> {
console.log(value);
})
這樣設定后,卻訪問不到,原因是,后臺也要有 test欄位, 這樣設定后,后臺訪問的URL為: http://localhost:88/test ,而不是 http://localhost:88
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/73774.html
標籤:JavaScript
上一篇:JavaScript連載15-return、函式宣告方式差異化、回呼函式
下一篇:vue-cli@2遷移到4
