防止页面按钮多次点击
onlineAssessment(item) { let elderInfoMation = JSON.stringify(item) console.log('this.isNavigating',this.isNavigating) if (this.isNavigating) return; // 如果正在跳转,则直接返回不执行后续操作 this.isNavigating = true; // 设置状态锁为真 uni.navigateTo({ url: `/pages/serviceElderly/newCapabilityAssessment/estimateElder/estimateElder?elderInfo=${elderInfoMation}`, success: () => { setTimeout(()=>{ this.isNavigating = false; // 页面跳转成功后,重置状态锁为假 },1000) }, fail: () => { setTimeout(()=>{ this.isNavigating = false; // 页面跳转成功后,重置状态锁为假 },1000) }, }) },
isNavigating: false, // 添加一个状态锁 在data里定义一个初始值
本文来自博客园,作者:prince11,转载请注明原文链接:https://www.cnblogs.com/prince11/p/18203401