代码直接复制粘贴即可用
changeAccount(val){
if(val){
let matches = /^(\d{3})(\d{4})(\d{4})$/.exec(val)
if(matches){
val = matches[1] + ' ' + matches[2] + ' ' + matches[3]
}
}
return val
},
checkPhone(val) {
// let reg = /^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\d{8}$/
let reg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
if (!reg.test(val)) {
return false;
} else {
return true;
}
},
效果: