第一次遇到请求multipart/fom-data,踩坑了.header千万别带s
header:{ 'Content-Type': 'application/x-www-form-urlencoded'} //header不要加s
uni.request({
url: '后端接口',
data: {
"mobile": '手机号',
"code":'验证码'
},
header: { // 请求头
"Content-Type": "application/x-www-form-urlencoded",
},
method: 'POST',
success: (res) => {
console.log(res)
}
})
这样就可以了