layer.msg("提示语...", { time: 5000, shade: 0.6, success: function (layero, index) { var msg = layero.text(); var i = 5; 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 () { //这里写需要执行的 });
源代码来自:http://fly.layui.com/jie/1950/ 用户geloom