vue 手机号码验证 。点击获取验证码


 

点击发送验证码

validateBtn() {
if (!/^1[3456789]\d{9}$/.test(this.mobile)){
this.isshow=true
this.msg="手机号码格式错误"
return false

}else{
this.isshow=false;
}
codesend({
phone: this.mobile,
})
.then(res => {
if (res.data.code === 1) {

console.log(res)
uid = res.data.data.uuId;
sessionStorage.setItem("uuId", res.data.data.uuId)
let time = 60;
let timer = setInterval(() => {
if (time == 0) {
clearInterval(timer);
this.disabled = false;
this.btnTitle = "获取验证码";
} else {
this.btnTitle = time + '秒后重试';
this.disabled = true;
time--
}
}, 1000)
} else {}
})
.catch(err => { //请求错误后执行函
})

},


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM