Skip to content

Commit

Permalink
refactor(forms): simplify form field list (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
mercs600 committed Nov 29, 2021
1 parent 7b73381 commit 8c66552
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/frontend/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ This template will be suitable for most regular input elements. You can use this
<br/>
:::

All fields are generated in the loop, based on T3Form schema. T3FormFormFramework component is responsible
All fields are generated in the loop, based on T3Form schema. T3FormFormFramework component is responsible for mapping fields to this strategy.


```json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ export default {
},
computed: {
elements () {
const elements = [...this.form.elements]
return this.prepareElements(elements)
return this.prepareElements(this.form.elements)
}
},
created () {
Expand Down
33 changes: 13 additions & 20 deletions lib/components/T3Form/T3FormFieldList/T3FormFieldList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,20 @@
:key="field.identifier"
:class="[`t3-form-field-${field.identifier}`, getCssClass(field, classes)]"
>
<template v-if="field.fieldlist">
<component
:is="getComponentField(field)"
:field="field"
>
<T3FormFieldList
ref="nested"
:elements="field.elements"
:components="components"
:classes="classes"
@input="updateModel"
/>
</component>
</template>
<template v-else>
<component
:is="getComponentField(field)"
v-model="model[field.name]"
:field="field"
<component
:is="getComponentField(field)"
v-model="model[field.name]"
:field="field"
>
<T3FormFieldList
v-if="field.fieldlist"
ref="nested"
:elements="field.elements"
:components="components"
:classes="classes"
@input="updateModel"
/>
</template>
</component>
</div>
</div>
</template>
Expand Down

0 comments on commit 8c66552

Please sign in to comment.