-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Allow slot-scope to be set on the defining component #7740
Comments
This is not possible if the <vue-parent>
<vue-parent slot-scope=props>
<vue-child>
{{ props.value }}
</vue-child>
</vue-parent>
</vue-parent> |
I feel the need for this, but the ambiguity pointed out by @posva is indeed a problem. We probably need some form of special syntax to get rid of the ambiguity: <foo slot-scope.self="{ msg }">
{{ msg }}
</foo> Or <foo $slot-scope="{ msg }">
{{ msg }}
</foo> |
It's confusing |
I'm not convinced about |
@anselwong |
@posva that's true. Primary reason is that using |
+1 for |
Hi! 👋 Is this in the v3 roadmap? I'm working on a collection of renderless components, and a Thanks!! |
Since we've shipped a new |
@yyx990803 您好,关于slot发现最新版本的Vue已经将 slot<tag>
{this.$slot.default}
</tag> slot-scope// parent
<tag>
{
this.$scopedSlots.default({data})
}
</tag> // children
const scopedSlots = {
scopedSlots:{
default:scope=>(<span>{scope.data}</span>)
}
}
<Parent {...scopedSlots}></Parent> 在Vue@3.x.x的时候,你们删除旧的插槽语法,上述的写法应该不再支持了吧? |
What problem does this feature solve?
slot-scope
can be set on a component that's a child of the component that defines the scoped slot.But it fails when it's set on the defining component itself. If there's only a default scoped slot then setting it on the parent should be allowed, because it would remove an unnecessary pair of tags in some cases and make the templates cleaner.
But mainly it's confusing and inconsistent to get an error that
props
isn't defined in the code below but not in the code above.What does the proposed API look like?
The text was updated successfully, but these errors were encountered: