manifest.json里找到H5,添加下面代码
请求封装里直接 url = ‘/test’ 就可以
"devServer" : {
"https" : false,
"port" : 8080,
"proxy" : {
"/test" : {
"target" : "http://192.168.5.20:8080",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"^/test" : ""
}
},
"/online" : {
"target" : "https://app.com",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"^/online" : ""
}
}
}
},
"router" : {
"mode" : "history"
}