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
如下代码所示,目前 vue 似乎没有提供在组件中用于判断插槽是否存在的方法,而在我自己实现组件库时,发现判断插槽是否存在是非常普遍使用的一个功能,而 vue 只提供了一个 useSlots() 方法,但是实际中有很多不同的情况需要处理,目前我也无法保证方法一定没有问题,只能是遇到一种情况就处理一种情况。无奈最终自己写了一个判断插槽是否存在的方法:https://themusecatcher.github.io/vue-amazing-ui/utils/functions/slots-exist.html 希望能尽快推出一个判断插槽是否存在的 api
子组件 Child.vue:
<div> <slot name="title">{{ title }}</slot> </div>
父组件 Parent.vue:
<Child> <template #title></template> </Child>
The text was updated successfully, but these errors were encountered:
see vuejs/core#4733
Sorry, something went wrong.
首先非常感谢回复!但是当我花了10分钟看我 #4733 之后,我依然充满疑问与挣扎,无法获得标准实现,大家都是各自发挥😭😭,那我也先用我自己的实现吧,至少目前可以说正常工作的
No branches or pull requests
如下代码所示,目前 vue 似乎没有提供在组件中用于判断插槽是否存在的方法,而在我自己实现组件库时,发现判断插槽是否存在是非常普遍使用的一个功能,而 vue 只提供了一个 useSlots() 方法,但是实际中有很多不同的情况需要处理,目前我也无法保证方法一定没有问题,只能是遇到一种情况就处理一种情况。无奈最终自己写了一个判断插槽是否存在的方法:https://themusecatcher.github.io/vue-amazing-ui/utils/functions/slots-exist.html
希望能尽快推出一个判断插槽是否存在的 api
子组件 Child.vue:
父组件 Parent.vue:
The text was updated successfully, but these errors were encountered: