时间:2019-05-07 来源:小程序工厂
漫***: onLoad: function() {
this.getOpenId((openid) => {
this.load()
this.show()
})
},
onShow: function() {
this.getOpenId(()=> {
this.show()
})
},
getOpenId: function(callback) {
if (app.globalData.openid) {
callback && callback(openid)
} else {
fetch().then((openid) => {
app.globalData.openid = openid
callback && callback(openid)
})
}
},
load: function() {},
show: function() {},
再加上阻止同时运行的判断就差不多可以了