Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slot for the item text itself #30

Open
Employee87 opened this issue Feb 1, 2023 · 9 comments
Open

Add slot for the item text itself #30

Employee87 opened this issue Feb 1, 2023 · 9 comments

Comments

@Employee87
Copy link

I see there is a slot for before and after. But what if I want to replace the actual text itself to some template code?

@N00ts
Copy link
Owner

N00ts commented Feb 12, 2023

that could be a good idea, you can propose a P%R if you want :)

@Employee87
Copy link
Author

Employee87 commented Mar 4, 2023

@N00ts I made the pull request, please check and merge, thanks.

#34

@N00ts
Copy link
Owner

N00ts commented Apr 12, 2023

Hey what is exactly the use case ? Can't you use existing slots ?

@Employee87
Copy link
Author

It's because by default the code will always take the text prop and show it in the treeview main text area. But for example I wanted to replace that with a highlight plugin like <highlight :search="search_text" :value="node.text" /> (which highlights part of the content based on the search text), and since I can't override the main text, I have to set text prop to empty string so that nothing shows in the main text area, and override the before or after slots with this highlight component. I then have to make a new property like text2 to use for the actual text. Plus I then have to inject some custom css to remove the margin around the main text area.

This could all be solved, if I have a slot for the main text area.

@N00ts
Copy link
Owner

N00ts commented Apr 18, 2023

Why not just a custom class ?

@Employee87
Copy link
Author

Employee87 commented Apr 18, 2023

I am not sure how that would help me though? Does the main area (i.e. not the before or after area) have a prop to insert a custom class?

@scscgit
Copy link

scscgit commented Jun 20, 2023

Another use-cases:

  • Adding an id to uniquely identify each node for test automation purposes, including whether it's a leaf node or not
  • Adding a title property

Isn't this slot a most basic feature users of a tree view would expect?

@dustin-auby
Copy link

This would help in many situations, i want to add tool tips to the nodes and would need to have a custom slot for the text to do this.

@MrAmine08
Copy link

How about making the label clickable? and not just the checkbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants