From 494e30306167ab60aeaf4b69de9773f4eecd0cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 10 Feb 2020 11:04:03 +0800 Subject: [PATCH] fix(Form): reset validate when checkbox changed --- src/field/index.js | 11 +++++++---- src/mixins/field.js | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/field/index.js b/src/field/index.js index a1da6f4a9..8621c7206 100644 --- a/src/field/index.js +++ b/src/field/index.js @@ -63,11 +63,8 @@ export default createComponent({ watch: { value() { + this.resetValidate(); this.$nextTick(this.adjustSize); - - if (this.validateMessage) { - this.validateMessage = ''; - } }, }, @@ -154,6 +151,12 @@ export default createComponent({ }); }, + resetValidate() { + if (this.validateMessage) { + this.validateMessage = ''; + } + }, + format(target = this.$refs.input) { if (!target) { return; diff --git a/src/mixins/field.js b/src/mixins/field.js index bf55f9682..ab1f1399a 100644 --- a/src/mixins/field.js +++ b/src/mixins/field.js @@ -5,6 +5,14 @@ export const FieldMixin = { }, }, + watch: { + value() { + if (this.vanField) { + this.vanField.resetValidate(); + } + }, + }, + created() { if (this.vanField) { this.vanField.children = this;