直接写在app.wpy里面,全局可以调用
// 防止重复点击事件
preventActive(fn) {
const self = this;
if (this.globalData.PageActive) {
this.globalData.PageActive = false;
if (fn) fn();
setTimeout(() => {
self.globalData.PageActive = true;
}, 3000); //设置该时间内重复触发只执行第一次,单位ms,按实际设置
} else {
console.log("重复点击或触发");
}
}

使用方法
this.$parent.preventActive(()=>{
//写你要执行的,防止重复执行,写里面
})
