//layer.msg弹窗倒计时 //second : 倒计时时间,单位,秒 //content: 弹窗内容,类型;String function countDown(second,content){ layer.msg(content, { time : 5000, shade: 0.6, success: function(layero,index){ var msg = layero.text(); var i = second; var timer = null; var fn = function() { layero.find(".layui-layer-content").text(msg+' '+i+' '); if(!i) { layer.close(index); clearInterval(timer); } i--; }; timer = setInterval(fn, 1000); fn(); }, }, function() { $("#btnSave").removeAttr("disabled"); }); }
原文链接:https://blog.csdn.net/guanzhengyinqin/article/details/78134514