Skip to content

Allow slot-scope to be set on the defining component #7740

Closed
@rightaway

Description

@rightaway

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.

<vue-parent>
  <vue-child slot-scope=props>
    {{ props.value }}
  </vue-child>
</vue-parent>

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?

<vue-parent slot-scope=props>
  <vue-child>
    {{ props.value }}
  </vue-child>
</vue-parent>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions