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