"devServer": {
"port": 8087,
"proxy": {
"/dev-api": {
"target": "http://192.168.1.127:8084",
"pathRewrite": {
"^/dev-api": ""
}
}
}
},
manifast.json中H5配置
// 后端服务地址
const baseUrl = '/dev-api'
export function publicRequest(url, method, params) {
return new Promise((resolve, reject) => {
uni.request({
url: baseUrl + url,
method,
header: {
Authorzation: 'Bearer ' + getToken()
},
data: {
...params
},
success: (res) => {
resolve(res)
},
fail: (err) => {
reject(err)
},
complete: () => {
uni.hideLoading()
}
})
})
}
request实例
1 个回复
西里哇基
请问解决了吗? 我也碰到了这个问题