0๐
โ
You can use the v-model directive to create two-way data bindings on
form input, textarea, and select elements.
https://v2.vuejs.org/v2/guide/forms.html
v-model
example:
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<div class="container" id="app">
<table>
<tr v-for="res in results" >
<td><input v-model="res.LinkTitle" :id="res.id"> </td>
<td> <input v-model="res.URL" :id="res.id"> </td>
</tr>
</table>
<button @click="showData">Show Data</button>
<br>
{{results}}
</div>
<script>
const vm = new Vue({
el: '#app',
created: function()
{
this.loadData();
},
data: {
results: [
{id:"1",LinkTitle:"title1",URL:"url1"},
{id:"2",LinkTitle:"title2",URL:"url2"}
]
},
methods:{
showData()
{
alert(this.results[0].URL);
}
}
});
</script>
Source:stackexchange.com