In my JavaScript I have:
data: {
rooms: [
{type: 'single'},
{type: 'double'}
...
],
selectedSingle: 0,
selectedDouble: 0,
...
},
computed: {
capitalize: function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
}
In HTML I have:
<li v-for="(room, index) in rooms">
<input type="number" v-model="'selected' + capitalize(room.type)">
</li>
The problem is that I can't find a way to access my models in this way, and the only way I see now is to destroy the v-for and make it manually, but it's not the best solution because I have many "rooms". Any ideas are welcome.