semisleep / simple-vue-validator

A simple yet flexible validator library for vue.js
MIT License
293 stars 28 forks source link

Add to documentation $setValidators #55

Open SlivaNilow opened 5 years ago

SlivaNilow commented 5 years ago

It is possible to add validation rules after loading a set of fields. For example, if the set of fields depends on the select.

Need create method

validate: function() {
       this.$setValidators(this.getValidatorRules());
       this.$validate();
}

where getValidatorRules return object

{
    'fieldName1' => function(){},
    'fieldName2' => function(){},
}