Skip to content

Accessing arbitrary attributes on a <template> tag #10282

Closed Answered by mrorabau
AllanJard asked this question in Help/Questions
Discussion options

You must be logged in to vote

First, full disclaimer, I am no Vue wizard, so any of the things I write here could be complete junk:

  1. Probably minor, but I suspect you are supposed to use useSlots() over getCurrentInstance().slots
  2. I think v-slot:name is supposed to be used/preferred for templates
  3. I was able to get the props to the children in a slot, but not to the template itself.

I think you could work around this using your own custom components and using a default slot (more like your second example, which I also like better). I'm not sure this example does precisely what you were looking for, and it is obviously written kinda poorly/quickly, but hopefully it is helpful:

StackBlitz Example

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mrorabau
Comment options

Answer selected by AllanJard
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants