app.js中
onLaunch: function () {
setTimeout(()=>{
const openId = "123456789" ;
this.globalData.openId = openId;
if(this.openIdReadyCallback){
this.openIdReadyCallback(openId)
}
},1000)
}
page中。。
onLoad(){
if(app.globalData.openId){
this.checkUserInfo();
}else{
app.openIdReadyCallback = res => {
this.checkUserInfo(res)
}
}
}
explain
openIdReadyCallback是自己起的名字;