layer弹框倒计时结束后执行

       var i = 10;
        var interval;
        layer.confirm('会议已结束',{
          btn: ['取消'],//按钮
          skin: 'layui-layer-molv',success: function(a,b){  
            var fn = function() {         
             layer.title(i+' 秒后,系统将自动退出并关闭。',b);      
              i--;
            };
            interval = setInterval(function(){
                fn();
                if(i === 0){// 倒计时结束后执行             
                  layer.title('',b);
                  clearInterval(interval);
                  layer.msg('倒计时结束',{icon: 1});
                }
              },1000);
          },end:function(){
            clearInterval(interval);
          }
          },function(){
            clearInterval(interval);
            layer.msg('已取消',{icon: 1});
          });

 

posted @ 2020-07-31 11:46  RealWorld♂  阅读(982)  评论(0编辑  收藏  举报