心影(LM)

导航

js按钮频繁提交解决方案:

1.封装js:

/// 函数节流
xhz.canRun = true;
xhz.Throttling = function () {
if (!xhz.canRun) {
layer.msg('处理中,不要频繁操作!', { zIndex:999999999, time: 2000 });
return false;
}
xhz.canRun = false;
setTimeout(function () {
xhz.canRun = true;
}, 2000);
return true;
}

  


2.调用方法:

//防止频繁提交
if (!xhz.Throttling()) {
return;
}

  

 

不要看他人高薪,且看闲时谁在拼

posted on 2019-05-22 18:11  心影(LM)  阅读(291)  评论(0编辑  收藏  举报