I'm a newbie in Vue.js development.
Using Vee-validate, I want to put validation rules "required" and "regex" (for example, telphone num should be required && \d{11}).
I read the official documentation carefully.
However, I can't figure out how to put two conditions including regex expression inside " created() " of Vue instance.
The below works:
this.$validator.attach({ name: "tel", rules: "required" });
but this does not work:
this.$validator.attach({
name: "tel",
rules: "{
required: true , regex: /\d{11}/
}'"
});
How can I enable more than one condition?
mounted
hook instead? – Maksim Nesterenkovalidator.attach({ name: "tel", rules: { required: true, regex: /\d{11}/ }});
– Daniel Bushman