let that = this
wx.cloud.callFunction({
name: "loginopenid"
}).then(res => {
wx.setStorageSync('openid', res.result.openid)
that.setData({
Storage_user_info: wx.getStorageSync('Storage_user_info')
})
if (that.data.Storage_user_info.Open_id == res.result.openid) {
console.log("获取缓存OPENID", that.data.Storage_user_info.Open_id)
????这个位置打印OPENID是正常的
that.setData({
img_url: that.data.Storage_user_info.head_sculpture
})
})
db.collection("shop_openId").get().then(res => {
var a = res.data[0].shop_openId
var b = wx.getStorageSync('Storage_user_info').Open_id
?????这里如果用that.data.Storage_user_info.Open_id就提示变量b未定义,只能用缓存数据
if (a == b) {
that.setData({
Show_order_management_buttons: true
})
}
})
?????这是什么原因啊
js异步问题,了解一下。
再重新去学一下Promise吧