方法一:
(function () {
var _isClick = true;
function onfastClick(){
if(_isClick){
_isClick =false;
setTimeout(function(){
_isClick = true;
},1000);
}
}
方法二:
function moreClick(){
let flag=true;
let timestamp = signMd5Utils.getDateTimeToString();
//时间戳,路径从缓存中获取,用户量大时,建议添加用户判断.
let preUrl = localStorage.getItem("X_Url");
let preTimeStamp = localStorage.getItem("X_TIMESTAMP");
if(preUrl !=null&&preTimeStamp!=null){
if(url==preUrl&×tamp-preTimeStamp<2){//同一个Url连接 //相差2s为多次点击
flag=false;
}
}
//时间戳,路径存入缓存
localStorage.setItem('X_Url',url);
localStorage.setItem('X_TIMESTAMP',timestamp);
return flag;
}