1、
let checkPhone = (rule, value, callback) => {
if (!value) {
return callback();
} else {
setTimeout(() => {
if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(value)) {
callback(new Error("手机号码格式不正确,请重填"));
} else {
callback();
}
}, 500);
}
};
2、
!/^((0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(value)
callback(new Error("电话号格式不正确"));
3、
!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(value)
callback(new Error("邮箱格式不正确"))
4、
!/(^\d{15}$)|(^\d{17}([0-9]|X)$)|(^[A-Z]{1}[0-9]{6}[(]{1}[a-zA-Z0-9]{1}[)]{1}$)|(^[A-Z]{1}[0-9]{8,10}$)/.test(value)
callback(new Error("身份证号格式不正确"))
5、
let reg = /^-?(\d+|\d+\.\d{1,2})$/;
const validateAccountInput = (rule, value, callback) => {
if (!String(value)) {
return callback('此项必填!');
}
else if (isNaN(value)) {
return callback('请填写数字值!');
}
else if (!reg.test(value)) {
return callback('请保留两位小数!');
}
else if (value > 10000) {
return callback('牌照费不得大于10000!');
}
callback();
};
vehicleLicenseFee: [
{required: true, message: '请输入', trigger: 'change'},
{validator: validateAccountInput, trigger: 'blur'}
]