Skip to content

Commit d25dc39

Browse files
committed
fix(form): form item should sync value and do not validate twice
1 parent c60bb5a commit d25dc39

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/form/form-item.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
if ((!debounceTime && debounceTime !== 0) || debounceTime < 0 || this.fieldValue.trigger === 'blur') return
153153
this.getValidatorModel = debounce((modelValue) => {
154154
this.syncValidatorValue()
155-
this.validate()
155+
// this.validate()
156156
return modelValue
157157
}, debounceTime, false, this.validatorModel[this.validatorModelKey])
158158
},
@@ -162,7 +162,7 @@
162162
focusOutHandler() {
163163
this.focused = false
164164
this.updateValidatorModel()
165-
this.validate()
165+
// this.validate()
166166
},
167167
initFocusEvents() {
168168
if (this.fieldValue.trigger === 'blur') {
@@ -246,6 +246,8 @@
246246
const defValue = getResetValueByType(fieldValue.type)
247247
this.validatorDisabled = true
248248
resetTypeValue(this, 'modelValue', defValue)
249+
// need to sync validator value too, because of trigger blur or debounce
250+
this.syncValidatorValue()
249251
this.$refs.validator && this.$refs.validator.reset()
250252
this.$nextTick(() => {
251253
this.validatorDisabled = false

0 commit comments

Comments
 (0)