当前位置:网站首页>Multiple clicks of the button result in results

Multiple clicks of the button result in results

2022-06-25 11:37:00 Your beauty fascinates me

 
//  Prevent processing multiple clicks 
function noMultipleClicks(methods, info) {
    
    // methods It is a function that needs to be executed after clicking , info Is to click the parameter to be transmitted 
    let that = this;
      
	if(!that.noClick){
    
		 that.noClick=true;
		 setTimeout(()=>{
    
			  that.noClick=false;
		 },5000)
		 
		   if(info && info !== '') {
    
		       // info Is the parameter that needs to be passed to execute the function 
		       methods(info);
		   } else {
    
		       methods();
		   }
		 
	 } else{
    
		uni.showToast({
    
			title:" Click frequency too fast ,5s Try again later ",
			icon:"none",
			duration:500
		})
	} 
	
}
// export 
export default {
    
    noMultipleClicks,// Multiple clicks are prohibited 
}

stay main.js Use

// Configure public methods

import common from './common/noMultipleClicks.js'
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;

Actual combat application :
 Insert picture description here

Print view :
 Insert picture description here

原网站

版权声明
本文为[Your beauty fascinates me]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251130172622.html