<span> Countdown : </span><span id="timer">{{time}}</span> time:'', maxtime:24*60 * 60 methods: { CountDown() { if (this.maxtime >= 0) { hour= Math.floor(this.maxtime / 3600); minutes = Math.floor(this.maxtime / 60 % 60); seconds = Math.floor(this.maxtime % 60); msg = this.checkTime(hour) + ":" + this.checkTime(minutes) + ":" + this.checkTime(seconds); this.time = msg --this.maxtime; } else{ clearInterval(timer); Alert (" Time is up, end!" ); this.left = false; this.right= false; this.midBottom = false; } var timer= setInterval(() => { clearInterval(timer) this.CountDown() }, 1000) }, checkTime(i) { if(i < 10) { i = "0" + i; } return i; }, mounted() { this.CountDown(); },Copy the code