startCountdown() restart doesn't work
avxkim opened this issue · 4 comments
avxkim commented
<countdown
ref="unregisterTimer"
:end-time="new Date().getTime() + 6000"
>
<template v-slot:process="{ timeObj }">
<span class="ml-3 timer">
Request SMS once again {{ timeObj.m }}:{{
timeObj.s
}}
</span>
<b-button @click="stopCountdown">STOP</b-button>
<b-button @click="startCountdown">START</b-button>
</template>
<template v-slot:finish="vac">
<b-button
@click="unregisterDevice"
class="ml-3"
variant="warning"
>Send again</b-button
>
</template>
</countdown>
Then a method:
private startCountdown() {
this.$refs.unregisterTimer.startCountdown(true)
}
Doesn't actually restart a countdown, i can pause it, then start, but restart doesn't work.
mlinquan commented
Click event unregisterDevice does not match your method startCountdown.
avxkim commented
Click event unregisterDevice does not match your method startCountdown.
Ofcourse it doesn't, because it does different thing, not restarting the countdown.
When i click <b-button @click="startCountdown">START</b-button>
it fires startCountdown()
method, which doesn't restart the timer.
mlinquan commented
My error, restart must use left-time, not end-time.
Reference example: https://codepen.io/mlinquan/pen/dyyWGyN
asmallkite commented
@mlinquan thanks,help me a lot~