无法通过全局变量获得openid?
wx.login({
success(res) {
//发起网络请求
wx.cloud.callFunction({
name: ‘login’
}).then(res => console.log(res)).then(db.collection(‘zhongdui’).add({
data: {
openid: res.result
}
})).then(
kkid = res.result,
)
}
})
其中kkid为全局变量,函数运行后kkid的值为undefined