Skip to content
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

在一个组件中定义了一个默认插槽和两个命名插槽,在该组件内部如何判断默认插槽是否有传入值? #782

Open
jingxin2015 opened this issue May 24, 2024 · 0 comments

Comments

@jingxin2015
Copy link

在一个组件中定义了一个默认插槽和两个命名插槽,在该组件内部如何判断默认插槽是否有传入值?
当只有一个默认插槽的时候,我可以通过 !!this.sourceSlots?.noname 来判断是否在组件外部传入默认插槽内容,但是当该组件同时有命名插槽的时候,如果只传入了命名插槽,this.sourceSlots?.noname 也是有值的,这样就不能通过这个来判断默认插槽了,有没有其他办法可以判断?谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant