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;
}

  

 

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

原文地址:https://www.cnblogs.com/BoKeYuan259/p/10907662.html