New Stuff
We got some PRs that contributed amazing features:
Automatic Classes
The plugin now allows you specify a collection of class names to be applied automatically on your inputs/components. Disabled by default.
to enable it you have to do this while registering the plugin:
Vue.use(VeeValidate, {
enableAutoClasses: true, // false by default
// Your classes
classNames: {
touched: 'touched', // the control has been blurred
untouched: 'untouched', // the control hasn't been blurred
valid: 'valid', // model is valid
invalid: 'invalid', // model is invalid
pristine: 'pristine', // control has not been interacted with
dirty: 'dirty' // control has been interacted with
}
});
Which should reduce tons of class binding repetitions in your code logic.
v-model Detection
If your input/component uses v-model
, you are no longer required to pass the arg. as of this release the plugin will check if v-model
is applied on the input/component and will allow it to watch it for value changes without additional listeners.
so before you used to do this:
<input type="text" v-model="email" v-validate:email="'required|email'">
or
<input type="text" v-model="email" v-validate="{ rules: 'required|email', arg: 'email' }">
You will be able to do this instead:
<input type="text" v-model="email" v-validate="'required|email'">
Which should reduce your code a bit, however like mentioned in #270 it still does not bind properly to loop iterators.
errors.firstRule('fieldName')
New method that allows checking if a field has a specific failing rule, which is helpful if you want to display errors from a CMS, meaning when you don't need the messages functionality.
<span v-show="errors.firstRule('email') === 'required'">FROM CMS: Email
is required</span>
<span v-show="errors.firstRule('email') === 'email'">FROM CMS: Email
invalid</span>
Fixed
- Provided a custom polyfill for both Array.from and Object.assign.
- Fixed an issue where files, checkboxes validation didn't work properly.