defineCustomElement
should inform wrapped Vue component that slots are being used
#768
pcoterecollective
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
🧵 Context
Following up on issues #8734, there’s a limitation when using
defineCustomElement
with slots.🐛 Problem
Consider the following Vue component:
When this component is registered as a web component using
defineCustomElement
, theheader
slot never renders, even if it is passed in via the DOM. This happens because$slots
anduseSlots()
are unaware that the slot is being used in the shadow DOM context.This can be a significant problem when building flexible, slot-driven web components with Vue.
💡 Suggestion
Introduce a new composable, such as:
This would return runtime-aware slot usage information in the context of
defineCustomElement
.If not used within a custom element, it could gracefully return empty or
false
values.✅ Why it matters
Beta Was this translation helpful? Give feedback.
All reactions