Vue codes button countdown

按钮:
<button class="yzm" @click="countDown">{{content}}</button>

event:

the countDown () {
IF (! this.canClick) // return the two lines of code changes is
this.canClick to false =
this.content = this.totalTime + 's after the re-transmission'
the let the window.setInterval Clock = (() = > {
this.totalTime--
this.content = this.totalTime + 's resend the'
IF (this.totalTime <0) {
window.clearInterval (Clock)
this.content = 'resend code'
this.totalTime = 60
this.canClick = reopen herein to true //
}
}, 1000)
},

Guess you like

Origin www.cnblogs.com/PoisonousMushrooms/p/11977859.html