Commit 6ae261d8 authored by 好多大米's avatar 好多大米 Committed by GitHub

Form: validate method reject error info (#21374)

parent 492ab00a
...@@ -116,8 +116,8 @@ ...@@ -116,8 +116,8 @@
// if no callback, return promise // if no callback, return promise
if (typeof callback !== 'function' && window.Promise) { if (typeof callback !== 'function' && window.Promise) {
promise = new window.Promise((resolve, reject) => { promise = new window.Promise((resolve, reject) => {
callback = function(valid) { callback = function(valid, invalidFields) {
valid ? resolve(valid) : reject(valid); valid ? resolve(valid) : reject(invalidFields);
}; };
}); });
} }
......
...@@ -921,8 +921,8 @@ describe('Form', () => { ...@@ -921,8 +921,8 @@ describe('Form', () => {
}; };
} }
}, true); }, true);
vm.$refs.form.validate().catch(validFailed => { vm.$refs.form.validate().catch(invalidFields => {
expect(validFailed).to.false; expect(invalidFields.name[0].message).to.be.equal('长度至少为5');
done(); done();
}); });
}); });
......
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