Commit 4109caadd87c4a2f99a1035816a429768070db56
Committed by
GitHub
1 parent
4ef54c6e
Update form-item.vue
修正`FormItem`使用`:error`动态设置错误信息后,`validateState`的值`error`永远无法清空的BUG
Showing
1 changed file
with
8 additions
and
3 deletions
Show diff stats
src/components/form/form-item.vue
@@ -85,8 +85,13 @@ | @@ -85,8 +85,13 @@ | ||
85 | }, | 85 | }, |
86 | watch: { | 86 | watch: { |
87 | error (val) { | 87 | error (val) { |
88 | - this.validateMessage = val; | ||
89 | - this.validateState = 'error'; | 88 | + if (val === '') { |
89 | + this.validateMessage = ''; | ||
90 | + this.validateState = ''; | ||
91 | + } else { | ||
92 | + this.validateMessage = val; | ||
93 | + this.validateState = 'error'; | ||
94 | + } | ||
90 | }, | 95 | }, |
91 | validateStatus (val) { | 96 | validateStatus (val) { |
92 | this.validateState = val; | 97 | this.validateState = val; |
@@ -246,4 +251,4 @@ | @@ -246,4 +251,4 @@ | ||
246 | this.dispatch('iForm', 'on-form-item-remove', this); | 251 | this.dispatch('iForm', 'on-form-item-remove', this); |
247 | } | 252 | } |
248 | }; | 253 | }; |
249 | -</script> | ||
250 | \ No newline at end of file | 254 | \ No newline at end of file |
255 | +</script> |