fix(Form): may scroll to incorrect field after submitted (#8159)

This commit is contained in:
neverland
2021-02-14 19:34:36 +08:00
committed by GitHub
parent c6e65f4fd6
commit 8cbf153073
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -159,10 +159,10 @@ export default createComponent({
.then(() => {
emit('submit', values);
})
.catch((errors) => {
.catch((errors: FieldValidateError[]) => {
emit('failed', { values, errors });
if (props.scrollToError) {
if (props.scrollToError && errors[0].name) {
scrollToField(errors[0].name);
}
});