微信小程序
小兔崽崽!
我还年轻!!!
展开
-
微信小程序 在开发者工具调试可以,在真机调试和预览没数据的解决办法
微信小程序在开发者工具上和苹果上用wx.request可以请求到数据,但是换做安卓机之后就没用。最后发现是要对其进行加一步数据的转换。在wx.request中加上这个就行. var json = res.data if (typeof json != 'object') { if (json != null) { json = json.replace("\ufeff", "") json = JSON.parse(js原创 2021-01-01 21:22:03 · 3063 阅读 · 6 评论 -
微信小程序wx.request
wx.request({ url: 'test.php', //仅为示例,并非真实的接口地址 data: { x: '', y: '' }, header: { 'content-type': 'application/json' // 默认值 }, success (res) { console.log(res.data) } fail: function (res) { console.log('Fail to request !原创 2021-01-01 21:11:04 · 291 阅读 · 0 评论