As the title says, I would like to add validation rules using vee-validate.
(for example, telphone num should be required &&\d{11})
I'm in trouble because there's no way to do it even if I look at the official documents.
https://vee-validate.logaretm.com/api.html#validator-fields
If you use regular expressions, you will get syntax errors even if you specify the following:
Working Example
this.$validator.attach({name:"tel", rules:"required"});
Example Not Working
this.$validator.attach({name:"tel", rules:"{required:true, regex:/\d{11}/}"});
This part is "unexpacted token:"
.
"{required:true, regex:/\d{11}/}'"
If you know more, please take care of me.
vue.js
this.$validator.attach({name:"tel", rules:"{required:true, regex:/\\d{11}/}});
© 2024 OneMinuteCode. All rights reserved.