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();
},

点赞(0)

评论列表 共有 0 条评论

暂无评论
立即
投稿
发表
评论
返回
顶部