關閉定時器(setTimeout/clearTimeout|setInterval/clearInterval)


 1.1 開啟Timeout程序: scope.setTimeout("functionName()" | functionHandle, timeValue) 返回值:timerID

  1.2 關閉Timeout程序: scope.clearTimeout(timerID);

  

  2.1 開啟Interval程序: scope.setInterval("functionName()" | functionHandle, timeValue)  返回值:timerID

  2.2 關閉Interval程序: scope.clearInterval(timerID);

60秒倒計時:

  let _this = this
      this.sendState = true;
     let time = setInterval(function(){
          _this.countdown-=1;
          if(_this.countdown==0){
            clearInterval(time)
            _this.sendState = false;
            _this.countdown = 60
          }
          console.log(_this.countdown)
      },1000)

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM