使用 wx.request
从后台取值成功不能用 that.setData({.......})
会报错 "this.setData is not a function;at api request success callback function"
此问题所在就是当前
this
指代不明
必须写成 var that=this;
指代当前 app
实例后,在 wx.request
方法中使用 that.data
获取当前 app
实例中数据
使用 wx.request
从后台取值成功不能用 that.setData({.......})
会报错 "this.setData is not a function;at api request success callback function"
this
指代不明
必须写成 var that=this;
指代当前 app
实例后,在 wx.request
方法中使用 that.data
获取当前 app
实例中数据
本文标题:小程序中请求(wx.request)报错问题
本文链接:https://www.haomeiwen.com/subject/bdxhpqtx.html
网友评论