N00ts/vue3-treeview

How to get the ID of the focused item?

hirisov opened this issue · 1 comments

Hello,

from the https://codesandbox.io/s/events-7st2s?from-embed=&file=/src/App.vue:355-385 example we can see how to bind a custom handler to the nodeFocus event. But how can I get the ID of the element which triggered this event please? How do I know which node the user clicked on? :)

thanks, Gabor

Never mind, got the solution:

<script>
function nodeFocus(event) {
    console.log(event.id)
}
</script>

<template>
                <treeview :config="treeConfig" :nodes="treeNodes" @nodeFocus="nodeFocus">
                </treeview>
</template>