-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
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
[Bug] When slot
is used with v-if
, the slot content is not displayed as expected
#7256
Comments
a workaround <Container :show-children="!show">
<div v-if="show" :key="1"> // add a key
Provided Content
</div>
</Container> |
This method can temporarily solve this problem, but if the component comes from an external library, we may need to find ways to avoid |
this is because of the slot children and the fallback children both as blocks but with empty dynamic children. <template>
<slot>
<div> // remove v-if also works.
Fallback Content
</div>
</slot>
</template> I usually use <slot v-if="$slots.default">
<div>
Fallback Content
</div>
</slot> |
Thank you for your suggestion. Currently, I was able to solve my problem this way. But this may still be something Vue needs to address, as it doesn't align with the usage as stated in the documentation. |
Vue version
^3.2.45
Link to minimal reproduction
https://sfc.vuejs.org/#eNqFks9ugzAMxl/Fy6WdVMgd0W5TpZ33AFwoGJo2JFES6AHx7nOAUfb/BHbsn/N9Ts9ejIm7FlnCUldYYTw49K05ZEo0RlsPPVisYIDK6gY2VLpZjo5a+VwotPNhzJdMYFJhpgqtHDHP+gb7QNpWuXT4mKmUT/NoEgUeGyNzjxQBpKfWe63guZCiuO4zNrc/hG/GxhoAr+taIkTQ9xN/GMZmPnVPpPsVk1ATFWchS4uKoGta5tNSdNBFoprHLWMA3qzuRInlqBeVn/Ipp45pyF02xSlftLAdm5yKmtzEF6cV2dyP8+YDl7EExkzIkWchztjZe+MSzl1VBCMvLta25vQX21Z50WCMrolOVt8cWX0hym7F4JTs0EYks0SL9i/ml9Jv3IAlWweS8mm3q/cic1WTaUHL8nagxIpKyTnj0klfMPU4u/+UwElriTmtHobD9p/n4KQO+Z/W9EFcres1l/KUF9ff1zXz1psa3gFE5As4
Steps to reproduce
What is expected?
show
istrue
.show
isfalse
.What is actually happening?
The slot content is not toggled.
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: