this.time就是定义的初速值
let timer = setInterval(() => {
if (this.time === 0) {
clearInterval(timer);//等于0是清楚定时器
} else {
this.time -= 1;
console.log(this.time);
}
}, 1000);
this.time就是定义的初速值
let timer = setInterval(() => {
if (this.time === 0) {
clearInterval(timer);//等于0是清楚定时器
} else {
this.time -= 1;
console.log(this.time);
}
}, 1000);