<el-button
icon=“el-icon-mobile-phone”
:disabled=“(disabled = !show)”
@click.native.prevent=“getCode”
>
获取验证码
{{ count }} s
data(){
return {
timer : null ,
count :0,
show: true,
}
}
if (!this.timer) {
this.count = 60
this.show = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= 60) {
this.count–;
} else {
this.show = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}