Reputation: 5424
i want to bind selected rows to an array, i'm trying to bind data from a v-for to the value of my input. I tried v-bind:value="row.id", i tried value={{row.id}} but nothing seems to be working.
<tbody>
<tr v-for="row in get_rows()">
<td>
<input type="checkbox" v-bind:value="row.id" v-model="selectedRows">
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
What am i doing wrong?
Upvotes: 0
Views: 80
Reputation: 193311
In order for your code to work you need to make sure you initialize selectedRows
as an array. Add this to your component:
data() {
return {
selectedRows: []
}
},
Upvotes: 1