Commit f4140493 authored by baiyaaaaa's avatar baiyaaaaa Committed by cinwell.li

fix form async validate bug (#1936)

parent 12e4b02e
......@@ -54,12 +54,13 @@
},
validate(callback) {
let valid = true;
let count = 0;
this.fields.forEach((field, index) => {
field.validate('', errors => {
if (errors) {
valid = false;
}
if (typeof callback === 'function' && index === this.fields.length - 1) {
if (typeof callback === 'function' && ++count === this.fields.length) {
callback(valid);
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment