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