<div v-for="(n, index) in items" :id="n" @click="myMethod($event)">{{n}}</div>
The array is like
items: [mouse, bull, tiger, rabbit, pig, cat, dog, horse]
The method is like
myMethod: function(event){
console.log(event.target.id);
}
I want to click each div and that div tells me its content, so I bind the content to the id of each div. The problem is I can't access the index of the items in myMethod(). I want to use the index of each item for other purposes. How can I access them? Currently I can only pass data to the method through the id attribute.
myMethod(n, index)