This section is dedicated to inputting the name
and surname
of individuals. It's a tiny component I've created.
<v-row v-for="(list,i) in getList" :key="'list-item-'+i">
<v-col cols="6"><v-text-field v-model="name"/></v-col>
<v-col cols="6" > <v-text-field v-model="surName"/></v-col>
</v-row>
data(){
return{
name:null,
surName:null
}
},
computed: {
getList() {
const newEntries = []
const entries = [
{category: 'elder', count: 3},
{category: 'babies', count: 1},
{category: 'children', count: 0}
]
entries.map(item => {
return item.count > 0 ? newEntries.push(item) : null
})
return newEntries
}
},
The getList
variable stores an array that has been filtered based on counts being greater than 0. My issue lies in creating the correct number of components for each object in the list. For example, if there are 3 elders and 1 baby in my getList
array, I should generate 4 component forms.
However, with my current solution I am only able to create 2 components – 1 elder and 1 baby. What I actually need are 3 elder components and 1 baby component.