手机号码和固话的正则表达式
作者:互联网
validator: (rule, value, callback) => { const reg = /(^0\d{2,3}-\d{7,8})$|(^[1][3,4,5,6,7,8,9][0-9]{9})$/ if (value === '' || value === undefined || value === null) { callback() } else { if (!reg.test(value)) { callback(new Error('请输入正确的手机号码或者固话!')) } else { callback() } } }
标签:callback,正则表达式,value,else,固话,手机号码,reg 来源: https://www.cnblogs.com/rumian/p/16336713.html