uniapp之uni.showModal 彈出多次導致重疊問題
場景:
端口權限過期後提示權限過期。但是同時調用多個接口導致多次報錯彈窗。
代碼:
if (code && code == 401) { let exists = uni.getStorageSync('token_expired') || false if (!exists) { uni.setStorageSync('token_expired', true) uni.showModal({ content: msg, showCancel: false, confirmText: "確認", success: (res) => { if (res.confirm) { store.dispatch('auth/logout') uni.reLaunch({ url: '/pages/login/index' }) } } }) } }
轉載自:https://ask.dcloud.net.cn/question/160759
翻譯
搜索
複製