success返回值怎么给外部变量赋值
发布于 5 年前 作者 lingang 18816 次浏览 来自 问答

function Info(uid) {

var that = this;

var head;

wx.request({

url: ‘’,

data: {

},

header: {

‘content-type’: ‘application/json’

},

success(res) {

that.head = res.data.head;

console.log(that.head);

}

})

console.log(that.head)

return that.head;

}

module.exports.Info = Info;

3 回复

不要that. 就对了。。

楼上正确,另外,需要看几篇关于【js 作用域 this】的文章

外部的head和success里的head不是同一个,我要怎么给外部的head赋值

回到顶部