data() {
/*验证邮箱 /
var checkEmail = (rule, value, callback) => {
var regEmail = /^(\w-.)+@(\w-?)+(.\w{2,})+/
if (regMobile.test(value)) {
return callback()
}
callback(new Error('请输入合法的手机号'))
}
return {
rules: {
email: [
{ required: true, message: '请输入邮箱', trigger: 'blur' },
{ validator: checkEmail, trigger: 'blur' },
],
mobile: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{ validator: checkMobile, trigger: 'blur' },
],
username: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
{
min: 3,
max: 10,
message: '用户名长度在3~10个字符',
trigger: 'blur',
},
],
password: [
{ required: true, message: '请输入密码', trigger: 'blur' },
{ min: 6, max: 15, message: '密码长度在6~15个字符', trigger: 'blur' },
],
},
}
},
网友评论