We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In Vue 2, empty slots could easily be detected from the component using this.$slots.{name} but this is not possible anymore with Vue 3.
this.$slots.{name}
For example, this component renders "no slot" with Vue 2.7.16 and "slot" with Vue 3.4.23:
# App.vue <SlotChange> <template v-if="false">empty</template> </SlotChange> # SlotChange.vue <template> <div> <template v-if="getSlotContent($slots.default)">slot</template> <template v-else>no slot</template> <hr /> <slot /> </div> </template> <script setup> function getSlotContent(slot) { return typeof slot === 'function' ? // Vue 3 slot() : // Vue 2 slot } </script>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In Vue 2, empty slots could easily be detected from the component using
this.$slots.{name}
but this is not possible anymore with Vue 3.For example, this component renders "no slot" with Vue 2.7.16 and "slot" with Vue 3.4.23:
The text was updated successfully, but these errors were encountered: