Skip to content

Commit a882181

Browse files
committed
feat(lib): 阻止表单默认submit事件
re #150
1 parent 245fd2c commit a882181

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/lib/vue2/vue2-core/src/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default function createForm(globalOptions = {}) {
4242
data() {
4343
const formData = getDefaultFormState(this.$props.schema, this.$props.value, this.$props.schema);
4444

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

@@ -177,6 +176,11 @@ export default function createForm(globalOptions = {}) {
177176
layoutColumn: !inline,
178177
[`layoutColumn-${layoutColumn}`]: !inline
179178
},
179+
nativeOn: {
180+
submit(e) {
181+
e.preventDefault();
182+
}
183+
},
180184
ref: 'genEditForm',
181185
props: {
182186
model: self.formData,

packages/lib/vue3/vue3-core/src/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ export default function createForm(globalOptions = {}) {
180180
formData: rootFormData.value
181181
});
182182
},
183+
// 阻止form默认submit
184+
onSubmit(e) {
185+
e.preventDefault();
186+
},
183187
model: rootFormData,
184188
...schemaProps.formProps
185189
},

0 commit comments

Comments
 (0)