Functional component not rendering named slot (following #8871)
See original GitHub issueVersion
2.5.17
Reproduction link
https://codesandbox.io/s/p9mx85qpz0
Steps to reproduce
nothing in particular.
What is expected?
It should display Hello World
What is actually happening?
It displays Hello
Following https://github.com/vuejs/vue/issues/8871 I made App.vue non-functional:
If you make Child.vue non-functional it works: https://codesandbox.io/s/pw5lzx2w90
If you use default (not named) slots it works: https://codesandbox.io/s/04jrp3y4ln
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
javascript - How to pass content to a slot in render function ...
A component using template: MyButton.vue <template> <div> <slot name="left"></slot> <button> <slot v-bind:person="person"> <span>按钮</span> ...
Read more >Slots - Vue.js
FancyButton renders slot content in its own template function FancyButton(slotContent) ... Slot content does not have access to the child component's data.
Read more >How to fix - Slot invoked outside of the render function in vue 3
Find out how to solve the following error: "slot invoked outside of the render function" while developing Vue 3 components.
Read more >PyCharm 2019.2.1 Release Notes | Knowledge Base
Bug, IDEA-218935, Gradle library imports broken after upgrade to 2019.2 ... parentOfType extension function fails when called from a plugin which bundles ...
Read more >Shadow DOM slots, composition
Then our component should render it properly, as a nice menu with given ... slot name, they are appended into the slot, one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Responded on the Vue Forum as well, is this maybe the same issue as in #7587?
It works by using a scoped slot: https://codesandbox.io/s/0p96w8o1pw
In this specific scenario, the
Parent
component should be written like this:I think we may need to adapt the functional component to allow passing a child with a
slot
attribute:@nickmessing I imagine the jsx plugin transforms into this because it has no way of knowing if
Child
is functional or not