uniapp之uni.showModal 弹出多次导致重叠问题
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