Skip to content

Commit 112ee14

Browse files
committed
fix(form): do not get btn field value
1 parent 6cf505b commit 112ee14

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/components/form/form.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@
6262
}
6363
},
6464
computed: {
65+
fieldsModel() {
66+
const model = {}
67+
this.fields.forEach((fieldComponent) => {
68+
if (!fieldComponent.isBtnField) {
69+
model[fieldComponent.fieldValue.modelKey] = fieldComponent.modelValue
70+
}
71+
})
72+
return model
73+
},
6574
groups() {
6675
const schema = this.schema
6776
const groups = schema.groups || []
@@ -127,13 +136,13 @@
127136
// sync all fields value because of trigger: blur or debounce
128137
this.syncValidatorValues()
129138
if (this.skipValidate) {
130-
this.$emit(EVENT_SUBMIT, e, this.model)
139+
this.$emit(EVENT_SUBMIT, e, this.model, this.fieldsModel)
131140
return
132141
}
133142
const submited = (submitResult) => {
134143
if (submitResult) {
135144
this.$emit(EVENT_VALID, this.validity)
136-
this.$emit(EVENT_SUBMIT, e, this.model)
145+
this.$emit(EVENT_SUBMIT, e, this.model, this.fieldsModel)
137146
} else {
138147
e.preventDefault()
139148
this.$emit(EVENT_INVALID, this.validity)

0 commit comments

Comments
 (0)