=>,request请求回来,this赋值取不到
发布于 6 年前 作者 guchao 17916 次浏览 来自 问答

getStore: () => {

let that = this;

var storeid = query.storeid;

wx.request({

url: url,

data: {

storeid: storeid

},

success: function (res) {

if (res.data.code == 0) {

console.log(that);

that.setData({

store: res.data.info

})

}

}

})

},

请求回来,打印出来的that是undefined,是不能这样赋值吗

1 回复

你为什么要打印undefined,不应该打印res.data.info这样的从服务器回调回来的数据吗

回到顶部