From 4109caadd87c4a2f99a1035816a429768070db56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E5=BA=86=E5=AE=89?= Date: Sat, 30 Sep 2017 03:40:21 -0500 Subject: [PATCH] Update form-item.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正`FormItem`使用`:error`动态设置错误信息后,`validateState`的值`error`永远无法清空的BUG --- src/components/form/form-item.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/form/form-item.vue b/src/components/form/form-item.vue index 01f6042d..654f5364 100644 --- a/src/components/form/form-item.vue +++ b/src/components/form/form-item.vue @@ -85,8 +85,13 @@ }, watch: { error (val) { - this.validateMessage = val; - this.validateState = 'error'; + if (val === '') { + this.validateMessage = ''; + this.validateState = ''; + } else { + this.validateMessage = val; + this.validateState = 'error'; + } }, validateStatus (val) { this.validateState = val; @@ -246,4 +251,4 @@ this.dispatch('iForm', 'on-form-item-remove', this); } }; - \ No newline at end of file +