I am iterating a object and displaying the result on a table.
HTML:
<div id="app">
<div id="app">
<p> SeletedId's {{ selectedIds }}</p>
<table class="table table-bordered table-hover table-striped">
<thead>
<tr class="text-center">
<th>
<span class="badge badge-info">Select</span>
</th>
<th>
<span class="badge badge-success">Name</span>
</th>
</tr>
</thead>
<tbody v-for="(pay,i) in PaymentType" :key="i">
<tr>
<td>
<input type="checkbox" v-model="selectedIds" :value="{selectedId: pay.Id}" />
</td>
<td>{{pay.Name}}</td>
</tr>
<!---I wanted to show the input box here -->
</tbody>
</table>
</div>
</div>
Vue:
new Vue({
el: '#app',
created(){},
data: {
message: 'Hello Vue.js!',
PaymentType: [{
Id: 1,
Name: "Cash",
HasOtherField: false,
Remarks: ""
},
{
Id: 2,
Name: "Check",
HasOtherField: false,
Remarks: ""
},
{
Id: 3,
Name: "Others",
HasOtherField: true,
Remarks: ""
}
],
selectedIds: []
}
})
I wanted to show a div or a row with a input box below the table. That should show/hide with the check box checked or unchecked.
For Hiding or showing the the input box i am implemented the following:
<div v-show="selectedIds[i]">
<span>Remarks</span><input type="text" class="form-control"/>
</div>
This is what i have done so far. The label Remarks and input box is not properly in-line.
