Skip to content

Provide method to get all routes #2940

Closed
@goeh

Description

@goeh

What problem does this feature solve?

If an application is split into several Vue components/libraries, each component can add their specific routes using router.addRoutes(array).
In the main application we then want to dynamically create menu items from all available routes. Currently there seems to be no way to get all routes, including those added with addRoutes().

We've done a workaround by importing routes manually from all included components and appending them into one array. This array is then used when constructing the router instance. It's a lot of boilerplate and easy to miss an import. A Router.getRoutes() method would really help in this use-case.

What does the proposed API look like?

router.getRoutes() or router.getAllRoutes() that returns an array of route configurations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestfixed on 4.xThis issue has been already fixed on the v4 but exists in v3group[dynamic routing]Issues regarding dynamic routing support (eg add, replace, remove routes dynamically)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions