Skip to content

Would be nice to have possibility of using multiple vue-route instances on same page #1870

@NobodyDies

Description

@NobodyDies

What problem does this feature solve?

I think it's quite logical - if you give us a class that potentially can have multiple instances to try set more than one instance on a page, even in different vue app instances. That can be made only for adstract mode.

jsfiddle

This issue was caused by attempt to make custom-element component that have it's own routing (an abstract one) from a ready vuejs app, wich have quite alot of logic.
And any page of an app can have multiple instances of it.

With that feature implemented it could be possible to make really modular pages that don't know what components they have inside, and components itself can be very complex. And it's the behavior that i think people are expecting - if you can have multiple Vue applications on a page, why only one router?

What does the proposed API look like?

i dont think that api should change, but it can be possible to set some uid to tell vue-router instance wich router-view tag to use with it. Something like

new VueRouter({
  mode: 'abstract',
  uid: 'first-app'
})

and in template

 <router-view data-uid='first-app'></router-view>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions