一:几秒后运行
layer.msg(data.msg,{icon:6,time:1000}); setTimeout(function () { //location.href = location.href; //$('#RefreshButton').click(); var index = parent.layer.getFrameIndex(window.name); layer.close(index); parent.location.reload(); // 父页面刷新 }, 1000)
二:访问同一方法
function submit(){ let data = {'status':0,'msg':'测试定时器1'}; if(data.status == 0){ layer.msg(data.msg,{icon: 5,time:1000}); //setTimeout("submit()", 5000); //两种方法都行 //window.setTimeout(submit, 5000); return false; } }