Regular slot and scoped slot with same name shouldn't be allowed
See original GitHub issueVersion
2.6.10
Reproduction link
https://codepen.io/lee88688/pen/jjPpBm?editors=1010
Steps to reproduce
as seen in codepen, “hello” component have only one slot. but rendered 2 div tag at last. I have a look at Vue’s code renderSlot which seems renderSlot function would treat the normal slot as scoped slot. why it would be like this?
the following code is render function of hello component which is compiled by Vue.compile. _t is renderSlot function. when normal slot and scoped slot in same component the problem above will be present.
(function anonymous() {
with (this) {
return _c('div', [_t("default"), _v(" "), _t("default", null, {
"x": x
})], 2)
}
}
)
What is expected?
render just one slot.
What is actually happening?
render one slot twice.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Tips to Supercharge Your Slots (Named, Scoped, and Dynamic)
Here, we're applying the slots to the Slots component, so they're all directly underneath that component. Just like with a regular slot, you...
Read more >Slots - Vue.js
Scoped Slots As discussed in Render Scope, slot content does not have access to state in the child component. However, there are cases...
Read more >The Difference Between Props, Slots and Scoped Slots in Vue.js
PROPS. They are attributes that are exposed to accept data from the parent component. Let's create a component MyMessage with props <template>
Read more >A Guide to Vue Slots - LearnVue
Simply put, scoped slots allow our slot content in our parent component to have access to data that's only found in the child...
Read more >API - Vue.js
vm.$scopedSlots · Scoped slot functions are now guaranteed to return an array of VNodes, unless the return value is invalid, in which case...
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
We tried to solve this issue with a small group, but we were unable to reproduce it in Vue 3. In the docs for Vue 3 this seems to be using a different approach. We are unsure if this issue is still relevant for Vue 3.
@kerm1it Does your commit fix the issue? If yes, are you planning on turning this into a PR?
Could you please let us know if this is still an issue? If so, we’d like to help find a solution.
If not, it might be worth it to close this issue.
https://github.com/vuejs/vue/pull/10217