I am using moment js
to countdown the time as 10,9,8,7,6 . It successfully counts down time on console.log
but I am not able to pass that as a data.
Below is my code on jsfiddle
Change the function inside setInterval
to an arrow functions, in order to read this
as the Vue component:
setInterval(() => {
duration.subtract(interval, "milliseconds"); //using momentjs substract function
this.countdownTimer = moment(duration.asMilliseconds()).format('s');
console.log(moment(duration.asMilliseconds()).format('s'));
/* countdown timer works for console.log */
}, interval );