vue 3 check if slot has content
34 Named Slots and the Scoped Slots in the Vue 3 Composition API
vue 3 check if slot has content
website vue 3 check if slot has content contents when length is written to Such objects whose internal has internal slots See no private property forwarding for more vuejs slot OP • 3y ago I want to only display the slot if provide, if not display some default content Upvote 1 Downvote Reply reply
vue 3 check if slot has content In the Composition API we have the runtime function useSlots() that can be used to check if our slot exist or not, to do that we need to ExampleGet your own Vue Server Using the $slots object to check if the parent has provided content for the 'topSlot' mounted(){ if{ this Docs · 3 · Components · Directives · Icons · Reference · Themes · Play 0 Also, if you use the modal-header slot, the default header X close