Browse Source

Form: fix initial error message

Leopoldthecoder 7 năm trước cách đây
mục cha
commit
81ff11ad41
1 tập tin đã thay đổi với 6 bổ sung3 xóa
  1. 6 3
      packages/form/src/form-item.vue

+ 6 - 3
packages/form/src/form-item.vue

@@ -73,9 +73,12 @@
       size: String
     },
     watch: {
-      error(value) {
-        this.validateMessage = value;
-        this.validateState = value ? 'error' : '';
+      error: {
+        immediate: true,
+        handler(value) {
+          this.validateMessage = value;
+          this.validateState = value ? 'error' : '';
+        }
       },
       validateStatus(value) {
         this.validateState = value;