Commit 3f17939d8eb90779dfaff7e33116977c14065983
Committed by
GitHub
Merge pull request #968 from MarvinWilliam/hotfix/formCommit
fix form default submit behavior.
Showing
1 changed file
with
7 additions
and
2 deletions
Show diff stats
src/components/form/form.vue
1 | 1 | <template> |
2 | - <form :class="classes"><slot></slot></form> | |
2 | + <form :class="classes" @submit="formSubmit"> | |
3 | + <slot></slot> | |
4 | + </form> | |
3 | 5 | </template> |
4 | 6 | <script> |
5 | 7 | // https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue |
... | ... | @@ -75,6 +77,9 @@ |
75 | 77 | if (!field) { throw new Error('[iView warn]: must call validateField with valid prop string!'); } |
76 | 78 | |
77 | 79 | field.validate('', cb); |
80 | + }, | |
81 | + formSubmit(event){ | |
82 | + event.preventDefault(); | |
78 | 83 | } |
79 | 84 | }, |
80 | 85 | watch: { |
... | ... | @@ -93,4 +98,4 @@ |
93 | 98 | }); |
94 | 99 | } |
95 | 100 | }; |
96 | -</script> | |
97 | 101 | \ No newline at end of file |
102 | +</script> | ... | ... |