vue使用正则验证

vue 使用正则验证

  • 定义 const
  • 使用 test 方法
testMethod(data){
	const reg = /^[^u4e00-u9fa5]{1,20}$/;
	if(reg.test(data)){
		console.log("通过正则验证");
	}else{
        console.log("未通过正则验证")
    }
}
原文地址:https://www.cnblogs.com/linux0kk/p/13822089.html