- post方法一:用默认的 header
header里 contentType值为:“application/json”,
注意示例 data的值为 :JSON.stringify(e.detail.value),
formSubmit:function(e){
//console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value))
var formdata = e.detail.value
//console.log(formdata);
uni.request({
url:'http://localhost:12722/api/user/login',
method:'POST',
data:JSON.stringi

本文主要探讨了在使用uni.request进行POST请求时的两种方式,特别是如何处理header中的'Content-Type'。当contentType设为'application/json'时,数据需通过JSON.stringify转换。另外,为适应C# WebAPI后台,可以将header设为'application/x-www-form-urlencoded'。
最低0.47元/天 解锁文章
8676

被折叠的 条评论
为什么被折叠?



