diff --git a/src/fields/abstractField.js b/src/fields/abstractField.js index 6d253241..100de8e3 100644 --- a/src/fields/abstractField.js +++ b/src/fields/abstractField.js @@ -24,7 +24,8 @@ export default { data() { return { - errors: [] + errors: [], + debouncedValidateFunc: null }; }, @@ -66,9 +67,6 @@ export default { if (this.$parent.options && this.$parent.options.validateAfterChanged === true) { if (this.$parent.options.validateDebounceTime > 0) { - if (!this.debouncedValidate) - this.debouncedValidate = debounce(this.validate.bind(this), this.$parent.options.validateDebounceTime); - this.debouncedValidate(); } else { this.validate(); @@ -130,7 +128,12 @@ export default { return this.errors; }, - + debouncedValidate() { + if(!isFunction(this.debouncedValidateFunc)) { + this.debouncedValidateFunc = debounce(this.validate.bind(this), objGet(this, "$parent.options.validateDebounceTime", 500)); + } + this.debouncedValidateFunc(); + }, clearValidationErrors() { this.errors.splice(0); },