小程序wx.request带中文参数使用post请求提交请求报400
小程序wx.request带中文参数使用post请求提交请求报400

原因:请求URL没有格式化
解决方案encodeURI函数
wx.request({
url: encodeURI(url),
data: {},
method: "post",
success: function(res) {
if (typeof callback == "function") {
callback(res)
}
},
fail: function(res) {},
complete: function(res) {
if (showLoad) {
wx.hideLoading()
}
}
})
浙公网安备 33010602011771号