-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
TypeError: When using template around template slot #11521
Comments
Workaround just specify the v-if on the slot directly. <template #item v-if="slots?.default">
<slot />
</template> |
However, there's a drawback that the Component which exposes the (View the console) |
You should get the specific |
Ah yes, it is indeed empty. I only got confused because the slots object wasn't empty but the specific item slot is empty so all is well |
I think this is an incorrect use of slot
<Comp>
<template v-if="xxx">
<template #item>
<slot />
</template>
</template>
</Comp>
<Comp>
<template v-if="xxx" #item>
<template>
<slot />
</template>
</template>
</Comp> |
Yeah I wasn't entirely sure if this is a valid use.. has it always been like this in the past ? Dunno how I can go further back in the playground.. |
For the following code: <my-component-with-hint-slot>
<template v-if="true">
<template #hint>hint</template>
</template>
</my-component-with-hint-slot> in Vue 2 I'm getting |
Ah I think this |
I agree with this. We need to emit user-friendly error at compile phase to align with vue2 |
Yes that'd be nice, after going through the vue2 source there were a couple more warnings which don't exist in that form in vue3 but I haven't checked which of these need to be ported to vue3. |
Implements the warning from vue2 in vue3. fixes vuejs#11521
Implements the warning from vue2 in vue3. fixes vuejs#11521
Implements the warning from vue2 in vue3. fixes vuejs#11521
Implements the warning from vue2 in vue3. fixes vuejs#11521
Implements the warning from vue2 in vue3. fixes vuejs#11521
Implements the warning from vue2 in vue3. fixes vuejs#11521
Vue version
3.4.35
Link to minimal reproduction
https://play.vuejs.org/#eNqFkk1PwzAMhv9KFA4DabRChcvoQIB2gAMgxjESqlp3ZLRJlY8yaep/x0k/VqQybonfx4n92nt6V1VBbYEuaKxTxStDNBhb3TDBy0oqQx5kWV2QXMmSzILQ31zC7JqJOGxTEMaLgbIqEgN4IyT2YHtsk/AchwND59ToVIqcb4KtlgL/3zuY0RRhXoB6qQyXQjO6IF5xWlIU8vvJx4yyMO/j6SekXxPxrd65GKOvCjSoGhgdNJOoDZhWXq2fYYfnQSxlZgukj4hvoGVhXY0tdm9FhmWPOF/to3eRi827Xu0MCN035Qp1ZON5RtFT59NfrR/KjYLI5zHRoIsuZ3KAx4aT8dof8KgLaYhISlgyypFi1GVisJtdi44mx0T3q1+D43vza236ren0PbEa1viRJk3HdQATuBgaH/TicuBOz/5fub6tXiH1Oc+xNf/WbZBBntgCbey4MXni2h/ivTXhgRx7MBFo93zCrI8alBs7ehUFl0F0RZsfhdgklw==
Steps to reproduce
Add another template around the template slot
so that it looks like this
What is expected?
No type error, or an error saying that this syntax isn't support (i'm not sure if this is actually supposed to work?)
What is actually happening?
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: