<view class="code-btn flex flex-center" @click="getCode">
{{countdown}}<u-verification-code :seconds="60" ref="uCode" @change="codeChange">u-verification-code>
view>
// 保存倒计时提示
countdown: "获取验证码",
// 设置倒计时60
seconds: 60,
//点击获取验证码
getCode() {
//this.$refs.uCode.canGetCode:用于判断是否能执行验证码操
if (this.$refs.uCode.canGetCode)
{
//this.$refs.uCode.start():用于调用倒计时
this.$refs.uCode.start();
} else {
this.$u.toast('倒计时结束后再发送');
}
//监听时间倒计时
codeChange(text) {
this.countdown = text;
},