-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to reset the countdown so that it starts from the beginning again? #46
Comments
Just use a <countdown v-if="enable">...</countdown> |
Ok. Do you have any idea why I can't set the time prop several times? |
@simonschaufi You are 'resetting' to the same value. Vue.js will not detect such a 'change', because of limitations in Javascript (https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats) You could do the following to work around this:
This works because you are first setting the time to another value and then back to the original value again, and thus triggering the change in Javascript. |
@fengyuanchen It might be an idea to add a |
@tafelnl Thank you very much for your idea. I will try it out. |
@simonschaufi I think it might even have to be like this:
The timeouts will take care that the countdown is actually only started when the time is set to the original value again. And not when it is |
I would like to reset the counter (see
resetCountdown
) and tried it with the following but once I stopped and started it again, it doesn't work a second time. The counter just continues counting down on and on.I found #39 but as you see in my code, I do just set the
time
prop again but as I said, it just works once.The text was updated successfully, but these errors were encountered: