Skip to content

Commit

Permalink
feat(lib): 阻止表单默认submit事件
Browse files Browse the repository at this point in the history
re #150
  • Loading branch information
lljj-x committed Feb 19, 2022
1 parent 245fd2c commit a882181
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/lib/vue2/vue2-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default function createForm(globalOptions = {}) {
data() {
const formData = getDefaultFormState(this.$props.schema, this.$props.value, this.$props.schema);

debugger;
// 保持v-model双向数据及时性
this.emitFormDataChange(formData, this.value);

Expand Down Expand Up @@ -177,6 +176,11 @@ export default function createForm(globalOptions = {}) {
layoutColumn: !inline,
[`layoutColumn-${layoutColumn}`]: !inline
},
nativeOn: {
submit(e) {
e.preventDefault();
}
},
ref: 'genEditForm',
props: {
model: self.formData,
Expand Down
4 changes: 4 additions & 0 deletions packages/lib/vue3/vue3-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ export default function createForm(globalOptions = {}) {
formData: rootFormData.value
});
},
// 阻止form默认submit
onSubmit(e) {
e.preventDefault();
},
model: rootFormData,
...schemaProps.formProps
},
Expand Down

0 comments on commit a882181

Please sign in to comment.