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