phoneNumber: (rule, value, callback) => {
const phoneReg = /^1[3|4|5|7|6|8|9][0-9]\d{8}$/
const telReg1 = /^(0\d{2,3})?\d{7,8}$/
const telReg2 = /^(0\d{2,3}-|\s)?\d{7,8}$/
if (phoneReg.test(value)) {
callback()
} else if (telReg1.test(value)) {
callback()
} else if (telReg2.test(value)) {
callback()
} else {
return callback(new Error('请输入正确的电话号码'))
}
},
网友评论