🐛 Fixed
- Fixed an issue where a field custom validity would be out of sync when the field is disabled, thanks to @ThomHurks #763
- Fixed an issue where
select
fields would not validate initially correctly. #804 - Fixed an issue that prevented field names that are numbers from working properly which should be perfectly fine for HTML. #805
- Fixed an issue that prevented custom errors from being removed before validating a field #818
- Fixed an error that occurred when unbinding the field #788 #801 #824
📦 New Builds
We added a new type of builds called minimal
which is stripped of all the built-in rules to reduce the size.
You would need to add the rules you need individually which will greatly reduce the bundle size in your app, the new files are vee-validate.minimal.js
, vee-validate.minimal.min.js
and vee-validate.minimal.esm.js
.
import Vue from 'vue';
import VeeValidate from 'vee-validate/dist/vee-validate.minimal';
import { Rules } from 'vee-validate';
Vue.use(VeeValidate);
// add the required rule
VeeValidate.Validator.extend('required', Rules.required);
Modern bundlers should take advantage of tree-shaking and only include the rules you need in your bundle. To make things easier you can make the minimal build as an alias if you are using Webpack in the resolve configuration.
✨ Enhancements
data-vv-as
now works on target fields, previously you needed to add the target name to the attributes dictionary, now it will just work. #765- Date validations (
after
,before
,date_format
,date_between
) are always included by default, as we have switched todate-fns
instead ofmoment
. validity
option is now set to false, which triggers native HTML5 error messages which might not be the intended behavior.- Flags are now available during the rendering of the template, meaning you longer need to do existence checks, but this however works for browsers that support ES6 Proxies, older browsers will have to use the checks. #758
valid
andinvalid
flags are always set (no longer initialized withnull
as an undetermined state).
Classes won't be added until the actual validation triggers to avoid causing an aggressive UI. using
.initial
modifier will work as expected though and will override this behavior.
⚠️ ✋ 🛑 Deprecations
This is a list of deprecated methods that will be removed in the next releases, they will continue to work for some time, but you need to switch to the alternatives if possible:
- Deprecate
validator.clean
, usevalidator.reset
instead. - Deprecate
validator.installDateTimeValidators
, as it is no longer needed. will display a warning instead. - Deprecate
validator.addLocale
, uselocalize
instead. - Deprecate
validator.updateDictionary
, uselocalize
instead. - Deprecate
setLocale
, just set it on the validator instance or class:
// switches the locale for all validators.
validator.locale = 'en';
// also available on the prototype
Validator.locale = 'en';
// another way to set the locale
validator.localize('en');
// merge the dictionary object and set the locale.
validator.localize('en', dictionary);