JSFiddle - React, Tailwind, and code Playground
HTML
<div id="vue">
Two different equal solutions:
<div v-for="thing in things">
<input
:value="thingsData[thing]"
@input="thingsData[thing] = $event.target.value">
<input v-model="thingsData[thing]">
</div>
<pre>{{thingsData}}</pre>
Btw, if thingsData doesn't contain values for all things at the start, you need to use $set instead of =
</div>
JavaScript
new Vue({
el: '#vue',
data: {
things: ['some', 'random', 'stuff'],
thingsData: {
some: 'pie',
random: 'cake',
stuff: 'cupcake'
}
}
})