I have a list of user details inside a scroll view with each having a button. It looks something like as follows:
User 1
User 2
User 3
The list is rendered using a v-for. On button pressed in each of the divs, I would like to extract some information, such as the User number. How can I approach this issue?
Using vue native you can simply do it this way
<view v-for="user in users" :key="user.id">
<button :on-press="()=> getDetail(user.number)" />
</view>
Then in your script
<scripts>
...
methods: {
getDetail(id){
this.number = id // assuming you already have this.number set in your data object
console.log(id)
}
}
<scripts />