vue 使用正则验证
- 定义 const
- 使用 test 方法
testMethod(data){
const reg = /^[^u4e00-u9fa5]{1,20}$/;
if(reg.test(data)){
console.log("通过正则验证");
}else{
console.log("未通过正则验证")
}
}
testMethod(data){
const reg = /^[^u4e00-u9fa5]{1,20}$/;
if(reg.test(data)){
console.log("通过正则验证");
}else{
console.log("未通过正则验证")
}
}