本文作者:程序员飞云
1. 找到对应的mainfest.json的源码视图

2. 配置h5
"h5" : { "title" : "sky-take-out-user-mp", "devServer" : { "disableHostCheck" : true, "proxy" : { "/api" : { "target" : "http://localhost:9000", "changeOrigin" : true, "pathRewrite" : { "^/api" : "" } } }, "https" : false }, "router" : { "mode" : "history" } }target代理到目标地址,pathRewrite会将/api去除
3. 修改baseurl
export const baseUrl = '/api'4. 最终请求地址
http://localhost:8080/api/xxxx
评论