79488832

Date: 2025-03-06 09:31:19
Score: 0.5
Natty:
Report link

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]) => {};
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): When you
  • Low reputation (1):
Posted by: yuanyxh