📜  如何做一个计时器角度 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:01:55.212000             🧑  作者: Mango

代码示例1
timeLeft: number = 60;
  interval;

startTimer() {
    this.interval = setInterval(() => {
      if(this.timeLeft > 0) {
        this.timeLeft--;
      } else {
        this.timeLeft = 60;
      }
    },1000)
  }

  pauseTimer() {
    clearInterval(this.interval);
  }




{{timeLeft}} Seconds Left....