When you recursively invoke this CustomTreeNode.vue component, you should propagate events down the hierarchy:
// CustomTreeNode.vue
<script setup lang="ts">
// other code here...
const childNodeClicked = (args: [Event, ICustomTreeNode]) => {
emit('node-clicked', [args[0], args[1]])
}
</script>
<template>
// other code here...
<CustomTreeNode
// other code here...
@node-clicked="childNodeClicked($event)"
/>
</template>
Additionally, when you pass parameters as an array:
emit('event-name', ['args1', 'args2'])
The event handler also receives parameters as an array:
const eventHandler = (args: [string, string]) => {};