N00ts/vue3-treeview

Custom icons per node

TechSupportJosh opened this issue · 3 comments

Hi there,

Is it possible to define an icon for a specific node? For example, if you're attempting to represent a file structure:

image

It would be nice to be able to override the "fakeIcon" inside TreeIcons.vue for something like this:

image

An example from codepen, where each file extension has a different icon:

image

Thank you!

N00ts commented

Hello, what is your use case ? Maybe you can use the slots to achieve this. If it does not fit you can customize open / close icon for each node.

Slots worked perfectly well, thank you! Is it possible to make the slots (or the entire node) clickable, rather than just the icon?

N00ts commented

You can do what you want with the slots. For example, you can @click.stop to avoid propagation to parent.
Here is an example for what you want to achieve (maybe reload needed)