js倒计时

2018-08-10  本文已影响0人  静_c540

/**

* 倒计时30s发送心跳

* */

getCode:function () {

const TIME_COUNT =30;

    var that=this;

    if (!that.timer) {

that.count = TIME_COUNT;

        that.timer =setInterval(function () {

if (that.count >0 && that.count <= TIME_COUNT) {

that.count--;

            }else {

clearInterval(that.timer);

                that.timer =null;

                that.getCode();

            }

}, 1000)

}

},

上一篇 下一篇

猜你喜欢

热点阅读