Parcourir la source

Form-item: rules validate sync (#21892)

bofeng il y a 3 ans
Parent
commit
a2b7304685
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      packages/form/src/form-item.vue

+ 5 - 0
packages/form/src/form-item.vue

@@ -95,6 +95,11 @@
       },
       validateStatus(value) {
         this.validateState = value;
+      },
+      rules(value) {
+        if ((!value || value.length === 0) && this.required === undefined) {
+          this.clearValidate();
+        }
       }
     },
     computed: {