Reputation: 794
I am trying to get the object on itemTap in a ListView. I want to be able to have access to the name
and age
of the object. But I can't figure out how to do this in the onItemTap
function
data
listOfItems: [{name: "Tom", age: 55}, {name:"Greg", age: 32}]
template
<ListView for="item in listOfItems" @itemTap="onItemTap($event)">
<v-template>
<Label :text="item.text" />
</v-template>
</ListView>
methods
onItemTap: function(args) {
???
}
Upvotes: 1
Views: 485
Reputation: 1414
See the docs
Template
<ListView for="item in listOfItems" @itemTap="onItemTap">
<v-template>
<!-- Shows the list item label in the default color and style. -->
<Label :text="item.text" />
</v-template>
</ListView>
Methods
onItemTap(event) {
console.log(event.index)
console.log(event.item)
}
Upvotes: 1