Does this work ?
v-model="model.address.city"
Or ...
v-model="model[address][city]"
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
We are working on project where we are setting v-model from UI. Below is example of use case
const model = ref({
address: {
city: 'Mumbai'
}
})
Now, we have string value of model key
const modelKey = "address.city"
that we are going to bind to input element like v-model="model.${modelKey}" or v-model="model[modelKey]" but I am pretty sure it doesn't work that way. We need to convert in some form of expression to work in v-model block.
Can you suggest how can we achieve such scenarios in vuejs?
Please or to participate in this conversation.