Skip to content

Commit

Permalink
fix(form): do not get btn field value
Browse files Browse the repository at this point in the history
  • Loading branch information
dolymood committed Aug 20, 2019
1 parent 6cf505b commit 112ee14
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/form/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@
}
},
computed: {
fieldsModel() {
const model = {}
this.fields.forEach((fieldComponent) => {
if (!fieldComponent.isBtnField) {
model[fieldComponent.fieldValue.modelKey] = fieldComponent.modelValue
}
})
return model
},
groups() {
const schema = this.schema
const groups = schema.groups || []
Expand Down Expand Up @@ -127,13 +136,13 @@
// sync all fields value because of trigger: blur or debounce
this.syncValidatorValues()
if (this.skipValidate) {
this.$emit(EVENT_SUBMIT, e, this.model)
this.$emit(EVENT_SUBMIT, e, this.model, this.fieldsModel)
return
}
const submited = (submitResult) => {
if (submitResult) {
this.$emit(EVENT_VALID, this.validity)
this.$emit(EVENT_SUBMIT, e, this.model)
this.$emit(EVENT_SUBMIT, e, this.model, this.fieldsModel)
} else {
e.preventDefault()
this.$emit(EVENT_INVALID, this.validity)
Expand Down

0 comments on commit 112ee14

Please sign in to comment.