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