-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support v-slot #1383
Support v-slot #1383
Conversation
On the surface, this looks good to me. Like you said, we probably want to refactor it into a function to hide the nested checks... but aside from that 👍 I'm curious if $parent will always be present -- can root elements have scopedSlots? I'm particularly thinking of components constructed with createElement. |
@JessicaSachs will need to investigate more to answer you questions, but got around to doing a refactor. My commit messages aren't styled property, will use the squash feature on Github to have a single nice commit message when we merge this. Might even be fine to merge as is and come back to address - thoughts? Maybe we don't cover every edge case, but should at least cover some. |
@JessicaSachs I tried a component like this: <template>
<slot name="blah" />
</template> To see what would happen to
I added a check for good measure, just in case. |
@lmiller1990 yeah you can’t make slots the root element when you use template functions, but you can with createElement and a render function. |
Hm, maybe I am missing something - does it make sense for the root element (eg I couldn't figure out how to write a render function with slots - if you can write a basic example I would be happy to add a test and see what happens. Thanks for the thorough review... slots feel like the most edge-casey of anything in VTU. We definitely need to get this right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right. This looks good.
I spent a few hours trying to break this using render functions on root vue components and other use cases and couldn't get it to break. I do a bunch of edgecase-y things in my prod app and this seems to handle all of it.
Great job mate! 🙌 |
Going to add one more test around |
Working on #1261
v-slot
syntax!