Skip to content

Support for multiple route-views inside a transition/keep-alive #1118

Open
@pearofducks

Description

@pearofducks

What problem does this feature solve?

The following is not possible if the my-modal component has transitions.

<my-modal>
  <template #default>
    <router-view>
  </template>
  <template #footer>
    <router-view name="footer">
  </template>
</my-modal>

If there's no footer slot, we can of course use the pattern suggested in the Vue Router docs and use router-view's slot props:

<router-view #default="{ Component }">
  <my-modal>
    <template #default>
      <component :is="Component" />
    </template>
  </my-modal>
</router-view>

But then there's no (apparent) way to solve this usecase for the footer slot.

What does the proposed API look like?

Whatever is most practical.

Provide all named views on the main router-view:

<router-view #default="{ Component, Components }">
  <component :is="Component" />
  <component :is="Components.Footer" />
</router-view>

Or enable nested router-views to work with named routes? (This is the solution the Vue Discord chat thought was working today for this problem)

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionThis problem still needs more feedbackenhancementNew feature or requestneeds RFCThis feature needs to go through the RFC process first

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions