Explorar o código

Form: :wrench: fixed validation issue with dynamic rules (fixed #1317)

Hashem Qolami %!s(int64=8) %!d(string=hai) anos
pai
achega
bfab5cd9ed
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      packages/form/src/form.vue

+ 6 - 1
packages/form/src/form.vue

@@ -23,6 +23,11 @@
       },
       inline: Boolean
     },
+    watch: {
+      rules() {
+        this.validate();
+      }
+    },
     data() {
       return {
         fields: []
@@ -54,7 +59,7 @@
             if (errors) {
               valid = false;
             }
-            if (index === this.fields.length - 1) {
+            if (typeof callback === 'function' && index === this.fields.length - 1) {
               callback(valid);
             }
           });