微信小程序wx.request 使用 post方式传参
method 是 get 方式的时候,header为
{"Content-Type": 'application/json'},
method 为 post 时,header为
{"Content-Type": "application/x-www-form-urlencoded"}
————————————————
wx.request({ url: 'http://...www/runxiang_yiyao/Mobile/Index/login', method: 'post', data: util.json2Form({ username: e.detail.value.username, password: e.detail.value.password, }), header: { "Content-Type": "application/x-www-form-urlencoded" }, success: function (res) { console.log(util.formatTime) // console.log(res) } })
————————————————