一、普通验证、数字验证、手机号验证、邮箱验证:
rules: {
//普通验证
loginName: [{
required: true,
message: '请输入',
trigger: 'blur'
}],
//数字验证
jobNumber: [{
required: true,
message: '请输入',
trigger: 'blur'
},
{
pattern: /^[0-9]*$/,
message: '请输入数字',
trigger: 'blur'
}
],
//手机号验证
mobile: [{
required: true,
message: '请输入',
trigger: 'blur'
},
{
pattern: /^1[3|4|5|7|8][0-9]{9}$/,
message: '请输入手机号',
trigger: 'blur'
}
],
//邮箱
email: [{
required: true,
message: '请输入',
trigger: 'blur'
},
{
pattern: /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/,
message: '请输入邮箱',
trigger: 'blur'
}
]
}
网友评论