My vue.js countdown function is updating too quickly.
Displayed below is the data section
data() {
return {
selected: [],
countdown: timerLimit
}
Here is the countdown method
countdownTimer() {
this.countdown = 60;
var downloadTimer = setInterval(() => {
if(this.countdown <= 0){
clearInterval(downloadTimer);
if (this.thisUser.captain) {
Store.submitTurnEnd();
}
}
this.countdown -= 1
console.log(this.countdown)
}, 1000);
},
I have noticed that after a few clicks, the countdown function speeds up. I believe I need to modify the data section, but I am uncertain of the correct approach.
Thank you for your assistance.