0👍
You should encapsulate your row code inside a div, and associate a click
action to it. Your JS code to find which one is clicked is useless. In your HTML:
<div v-for="(order, col) in todayOrders">
<p @click="rowDidClick(order)">
Id: {{order.number}} <br> {{order.date_created}} <br> <br/>
{{order.billing.first_name + " " + orders.billing.last_name }}
</p>
</div>
In your JS code:
<script>
export default {
methods: {
rowDidClick(orderObjectThatHasBeenClicked) {
// do stuff
}
}
}
</script>
Check the Vue.js guide, it is by far one of the best documentation written.
Source:stackexchange.com