data() {
return {
username: "",
passwords: "",
}
},
// 登陆的接口
login() {
let mobileReg = /^1(3|4|5|7|8|9)\d{9}$/; //手机号
let emailReg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/; //邮箱
let codeReg = /(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]{6,16}$/ //密码
if (!this.username) {
this.$toast('请填写手机号或邮箱');
} else if (!mobileReg.test(this.username) && !emailReg.test(this.username)) {
this.$toast('手机号或邮箱格式不正确');
} else if (this.passwords == "") {
this.$toast('请输入登录密码');
} else if (!codeReg.test(this.passwords)) {
this.$toast('请输入正确的密码');
} else {
this.show = true; //为true时显示弹框
}
},
验证手机号以及邮箱,密码6-18位的字母加数字的方式 正则登录方式
猜你喜欢
转载自blog.csdn.net/qq_39603448/article/details/89961698
今日推荐
周排行