I am working with a data record
record: {
address: {
city: ""
}
}
There is an array of objects that describe fields
fields: [
{
name: "address.city"
...
}
]
My objective is to generate a form dynamically
<b-field
v-for="field in fields"
:key="field.name"
:label="field.label"
>
<b-input v-model="record[field.name]" />
</b-field>
I need to access object items using keys like address.name
.
Although I understand that I should use record[address][city]
for the v-model, how can I achieve this from a dot-delimited string?
Is there a way to make it work?