My scenario involves a Vue app with the following data:
data: function() {
return {
items: [
{id: 1, text: 'one', other_data: {}},
{id: 2, text: 'two', other_data: {}},
{id: 3, text: 'three', other_data: {}}
]
}
}
The template is structured as follows:
<div v-for="item in items" id="my_items">
<span>{{ item.text }}</span>
</div>
I am looking to access a specific item by using external JavaScript code, like this example:
let item_node = document.getElementById('my_items').children[1]; // Retrieve the 2nd child node of #my_items
item_node.__vuedata__ // This should represent the second item from the Vue data. {id: 2, text: 'two'...
Is there a way to achieve this functionality?