I'm rendering a list in Vue and trying to implement some collision detection. I'm looking to return the exact same object as 'item' through [DomElement].__vue__
Is there a property on __vue__ that matches the object of the item? Where is this stored?
data:
items: [
{ name: 'one' },
{ name: 'two' }
]
component:
<icon
v-for="item in items"
@click="match(item, $el)">
{{ item.name }}
</icon>
method:
match(item, el){
console.log(item === el.__vue__) // how can I make these match?
// el.__vue__.whereCanIFindItem ??
}
EDIT:
A bit more information on why I'm doing this:
I'm trying to convert the selection.js library into a Vue component. Essentially when a DOM element is clicked, it returns an event.target - and from that I'm trying to get a reference back to the object that rendered it. When I run a comparison between the item object from the loop and the item's [DOMelement].__vue__ I get a false result.
I know the item and the item's dom __vue__ property are the same, but they're not returning true in comparison checks ===.
itemin that way?__vue__is just a reference to the root Vue, so theitemsdata array would just beel.__vue__.items.