手机号正则:/^((13[0-9])|(17[0-1,6-8])|(15[^4,\\D])|(18[0-9]))\d{8}$/
var Telchange = (rule, value, callback) => {
// console.log(value);
var tel = value.replace(/\s/g, "");
let regs = /^((13[0-9])|(17[0-1,6-8])|(15[^4,\\D])|(18[0-9]))\d{8}$/;
if (value.length != 0) {
if (!regs.test(tel)) {
callback(new Error("手机号输入不合法"));
} else {
callback();
}
}
};
rules:{
mobile: [
{ validator: Telchange, trigger: "blur" },
{ required: true, message: "请输入手机号", trigger: "blur" }
]
}