Explorar el Código

Form: clearValidate supports string type param (#12990)

刘晓 hace 6 años
padre
commit
a9026606e0
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      packages/form/src/form.vue

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

@@ -85,7 +85,10 @@
       },
       clearValidate(props = []) {
         const fields = props.length
-          ? this.fields.filter(field => props.indexOf(field.prop) > -1)
+          ? (typeof props === 'string' 
+              ? this.fields.filter(field => props === field.prop)
+              : this.fields.filter(field => props.indexOf(field.prop) > -1)
+            )
           : this.fields;
         fields.forEach(field => {
           field.clearValidate();