fix(frontend): Wrong index when updating FormElement
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div v-for="formElement in props.modelValue" :key="formElement.id">
|
||||
<div v-for="(formElement, index) in props.modelValue" :key="formElement.id">
|
||||
<component
|
||||
:is="getResolvedComponent(formElement)"
|
||||
:form-options="formElement.options"
|
||||
@update:form-options="updateFormOptions($event)"
|
||||
@update:form-options="updateFormOptions($event, index)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -35,9 +35,9 @@ function getResolvedComponent(formElement: FormElementDto) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateFormOptions(formOptions: FormOptionDto[]) {
|
||||
function updateFormOptions(formOptions: FormOptionDto[], formElementIndex: number) {
|
||||
const updatedModelValue = [...props.modelValue]
|
||||
updatedModelValue[0] = { ...updatedModelValue[0], options: formOptions }
|
||||
updatedModelValue[formElementIndex] = { ...updatedModelValue[formElementIndex], options: formOptions }
|
||||
emit('update:modelValue', updatedModelValue)
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user