Skip to content

Commit

Permalink
fix(forms): emit event for nested objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder committed Sep 18, 2024
1 parent babeeea commit cf7c003
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/forms/src/components/fields/FieldArray.vue
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ export default {
getFieldType(fieldSchema) {
return 'field-' + fieldSchema.type
},
modelUpdated() {},
modelUpdated(model, schema) {
this.$emit('modelUpdated', model, schema)
},
handleInput(val, index) {
this.value = this.value.map((item, i) => i === index ? val : item)
},
Expand Down
5 changes: 5 additions & 0 deletions packages/core/forms/src/components/fields/FieldObject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
:model="value"
:options="formOptions"
:schema="schema.schema"
@model-updated="updateModel"
/>
<div v-else>
<table
Expand Down Expand Up @@ -124,6 +125,10 @@ export default {
this.keyTypes = { ...this.keyTypes }
this.newKeyName = ''
},
updateModel(model, schema) {
this.$emit('modelUpdated', model, schema)
},
},
}
</script>
Expand Down

0 comments on commit cf7c003

Please sign in to comment.