<q-field
helper="验证码"
class="q-mt-md"
:error="$v.form.sendcode.$error"
error-label="验证码格式错误"
>
<div class="row no-wrap">
<q-input
v-model.trim="form.sendcode"
:autofocus="true"
@input="$v.form.sendcode.$touch()"/>
<q-btn
outline push
color="primary"
size= "sm"
:disable= "$v.form.phoneNumber.$invalid"
:loading= "waitcode"
@click="waiting">
获取验证码
<span slot="loading">
<q-spinner-gears class="on-left" />
重新获得 {{ time }}
</span>
</q-btn>
</div>
</q-field>
export default {
data () {
return {
waiting: false,
time: 0,
}
},
methods: {
waitcode () {
this.waiting = true
this.time = 60
this.timer()
},
timer () {
if(this.time <= 0)
{
this.waiting = false
}
else
{
this.time--
setTimeout(this.timer, 1000)
}
}
}
}