Skip to content

Commit

Permalink
[feature]{GenerateForm}: 表单验证校验失败时自动focus
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Jun 16, 2019
1 parent a9ebbca commit c01c7e8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/FormDesigner/GenerateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ export default {
if (valid) {
resolve(this.formValueToString(), args);
} else {
setTimeout(() => {
const isError = document.getElementsByClassName('is-error');
isError[0].querySelector('input').focus();
}, 100);
reject(new Error('表单数据校验失败').message);
}
});
Expand Down

0 comments on commit c01c7e8

Please sign in to comment.