1.在main.js里加入
Vue.prototype.$onLaunched = new Promise(resolve => {
Vue.prototype.$isResolve = resolve
})
2.app.vue最后加入
this.$isResolve()
3.需要等待配置的页面在onload加入
async onLoad() {
// 等待登录结果返回
await this.$onLaunched;
// 处理后续业务逻辑(此时已存在token值)
console.log(uni.getStorageSync('token'));
this.getData();
},
发表评论 取消回复