wx.getStorage不能给data里的变量赋值
var openid;
Page({
data: {
openid:""
}
onShow: function () {
var that = this;
wx.getStorage({
key: ‘openid’,
success: function (res) {
console.log(res.data);//有值的
that.data.openid = res.data;
openid = res.data;
}
})
}
console.log(that.data.openid): 显示空
console.log(openid): 显示undefined
})