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
vue slot 里面插入slot上面的默认内容显示不出来,而且我在我的项目里还会出现undefined #12153
Comments
It's <HelloWorld msg="Hello Vue in CodeSandbox!">
<template #hello>123</template>
</HelloWorld> or Please, next time consider using the forum, the Discord server or StackOverflow for questions first. But feel free to come back and open an issue if it turns out to be a bug 🙂 |
额。。。那这个和旧的就不兼容了啊 |
If slot fallback content is Vue component, fallback content is not work, |
yes,Can this problem be solved |
fallback to |
要注意 vue 与 vue-template-compiler 版本一致,主要原因是 vue 中 renderSlot 方法 调整,在 v2.6.13 版本,renderSlot 第二个参数支持 函数类型,同时 vue-template-compiler 编译slot 返回一个函数,但是v2.6.12 版本,renderSlot 第二个参数只是VNode,同时 vue-template-compiler 编译slot 直接返回一个VNode。因此如果 vue-template-compiler 版本比vue 版本高,就会出现这种情况。希望有帮助 |
fallback to 2.6.12 its work for me too,thanks for @BryanAdamss |
我目前也是这样,slot的后备内容没法正常渲染,vue 2.6.12 vue-template-compiler 2.6.12,版本一致呀,请问要更新到哪个版本还是回退到哪个版本,我都快吐了,不想看源码了。 |
检查下node_modules和lock文件,看下最终安装的版本是否都是2.6.12 |
ok啦,package里面的版本做了向上导致node_modules一直下的最新包 |
get it! thanks all. |
Version
2.6.14
Reproduction link
https://codesandbox.io/s/amazing-easley-n35zm?file=/src/components/HelloWorld.vue
Steps to reproduce
组件里面写两个slot
hello
父页面调用组件
123
就显示不出来插槽默认内容
What is expected?
不要出现这个bug
What is actually happening?
出现了slot bug
The text was updated successfully, but these errors were encountered: