mlinquan/vue-awesome-countdown

How to reset the timer without restarting it?

yaki6 opened this issue · 3 comments

yaki6 commented

Hi,
Now I have the use case of resetting the timer without starting it automatically but I could not find a way to do it. Now I am using startCountdown method with restart passed but it would restart the timer automatically. Is there a way just to reset the timer? Thanks.

You can stop first, then change the left-time value, and then restart.

You can stop first, then change the left-time value, and then restart.

For some reason this is not working for me.. I am using version 1.1.4, vue 2.6.12.

When i try to reset the countdown i use this code ( in a function):

this.$refs.vac.stopCountdown();
this.time = new Date(this.horse.end_date).getTime();
this.$refs.vac.startCountdown(true);

FYI: this.horse.end_date contains the new date.

and this is how I create the countdown:

<vac :end-time="time" :left-time="time - new Date().getTime()" class="timer" @finish="ended" ref="vac">

But for some reason it does apply the new date.

endTime and leftTime cannot be used at the same time.