Commit 3f17939d8eb90779dfaff7e33116977c14065983

Authored by Aresn
Committed by GitHub
2 parents 219e5c92 d22e3671

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 <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>