h5弹出层和页面跳转相继执行(js暂停)

xiaoxiao2021-02-28  98

//暂停函数 function Pause(obj, iMinSecond) { if(window.eventList == null) window.eventList = new Array(); var ind = -1; for(var i = 0; i < window.eventList.length; i++) { if(window.eventList[i] == null) { window.eventList[i] = obj; ind = i; break; } } if(ind == -1) { ind = window.eventList.length; window.eventList[ind] = obj; } setTimeout("GoOn(" + ind + ")", iMinSecond); } function GoOn(ind) { var obj = window.eventList[ind]; window.eventList[ind] = null; if(obj.NextStep) obj.NextStep(); else obj(); } function Demo() { $api.toast("支付成功", 600); Pause(this, 1000); //调用暂停函数   this.NextStep = function() { api.closeFrame({ name: 'pay_info' }); } }

//end暂停函数

调用

Demo();

转载请注明原文地址: https://www.6miu.com/read-26259.html

最新回复(0)