vue.js用正则校验的方法:首先定义const;然后使用test方法,代码为【if(reg.test(data)){console.log("通过正则验证");}else{console.log("未通过正则验证")}}】。

【相关文章推荐:vue.js】
vue.js用正则校验的方法: 定义 const 使用 test 方法 testMethod(data){
const reg = /^[^\u4e00-\u9fa5]{1,20}$/;
if(reg.test(data)){
console.log("通过正则验证");
}else{
console.log("未通过正则验证")
}
}相关免费学习推荐:javascript(视频)
以上就是vue.js怎么用正则校验的详细内容,更多请关注模板之家(www.mb5.com.cn)其它相关文章! |