首页 > 【fiveClick】2秒内5连击(五连击)vue事件自定义、双击自定义、任意次连击

【fiveClick】2秒内5连击(五连击)vue事件自定义、双击自定义、任意次连击

 

    // 2秒内5连击(默认)________________________multiClick(multiClickCallback,singleClickCallback,maxTimes = 5,time = 2000) {this.clickTimes || (this.clickTimes = 0);++this.clickTimes >= maxTimes &&(multiClickCallback && multiClickCallback(),singleClickCallback || (this.clickTimes = 0));this.clickTimes === 1 &&setTimeout(() => {this.clickTimes < maxTimes &&singleClickCallback &&singleClickCallback(); //执行单击or少于maxTimes次的点击this.clickTimes = 0;}, time);},// 双击场景demo________________________triggerMultiClick(data, node) {this.multiClick(() => {// 双击},() => {// 单击 },2,300);},

更多相关: