ElementUI验证手机号:
rules: {
phone: [
{
required: true,
validator: (rule, value, callback) => {
if (!value) callback(new Error('请输入联系电话!'));
if (!/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(value))
callback(new Error('请输入正确的联系电话!'));
callback();
},
trigger: ['blur', 'change']
}
]
}
这是正则表达式嘛?