Due to recursive components, this kind of nesting will occur
<tree>
<tree>
<tree>
</tree>
</tree>
</tree>
It’s easy to select the outermost one. Dynamically register a Vuex module. Whichever one is clicked will be passed to this module.
But it is troublesome to implement click and $emit events in the tree structure. They are nested layer by layer and it is almost impossible to broadcast
Please tell me how to solve this problem
You can use $on and $emit:
Custom events
The officially recommended approach is to use a Vue instance as the event bus.