mmybz

60秒倒计时

2018-01-01 21:10  卢焓然  阅读(106)  评论(0编辑  收藏  举报
if (!(/^1[34578]\d{9}$/.test(this.$refs.isPhoneNumber.value))) {
alert(\'请输入正确的手机号\')
} else {
alert(\'短信已发,请尽快使用\')
const TIME_COUNT = 60
if (!this.timer) {
this.count = TIME_COUNT
this.isReally = false
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= TIME_COUNT) {
this.count--
} else {
this.isReally = true
clearInterval(this.timer)
}
}, 1000)
}
}

分类:

技术点:

相关文章: