倒计时函数

                      djs(){				
				this.allMiao=3600*this.shi+this.fen*60+this.miao;
				 var tt=setInterval(()=>{
					 this.allMiao--;
					 this.shi=parseInt(this.allMiao/3600); 
					 this.fen=parseInt((this.allMiao%3600)/60);
					 this.miao=this.allMiao-this.shi*3600-this.fen*60;
					 // console.log(this.allMiao,this.shi,this.fen,this.miao);
					 	if(this.shi<10){
					 		this.shi='0'+this.shi
					 	}
					 	if(this.fen<10){
					 		this.fen='0'+this.fen
					 	}
					 	if(this.miao<10){
					 		this.miao='0'+this.miao
					 	}					 											 	
					 	if(this.allMiao == 0){
					 		clearInterval(tt);
					 		console.log("时间到")
					 	}
					  // console.log(this.allMiao,this.shi,this.fen,this.miao);
					 
				 },1000)
				
				
			}        

  

posted @ 2020-03-20 19:48  福超  阅读(228)  评论(0编辑  收藏  举报