I am creating a table using Vue.js and I want to define an onClick
event for each row that passes contactID
. Here is the code:
<tr v-for="item in items" class="static"
v-bind:class="{'evenRow': item.oddeven=='1', 'oddRow': item.oddeven=='0' }"
@click="addToCount('{item.contactID}')"
>
<td>{{item.contactName}}</td>
<td>{{item.recipient}}</td>
</tr>
On clicking a row, it is calling addToCount()
, which is working. I want to pass item.contactID
to addToCount()
. Could someone suggest the correct syntax for this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…