乐趣区

javaScript倒计时

// 倒计时
let timeinterval="";
let countDownStart="";
countDown(timeTotal) {timeinterval = setInterval(() => {
    timeTotal--;
    countDownStart = timeTotal + "秒";
    if (timeTotal <= 0) {clearInterval(this.timeinterval);
        countDownStart = "倒计时开始";
    }
}, 1000);
}
countDown(60);
退出移动版