Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to dynamically add child routes #2020

Closed
smares opened this issue Jan 25, 2018 · 1 comment
Closed

Add ability to dynamically add child routes #2020

smares opened this issue Jan 25, 2018 · 1 comment

Comments

@smares
Copy link

smares commented Jan 25, 2018

Version

3.0.1

Reproduction link

https://jsfiddle.net/qv9z3x99/

Steps to reproduce

vue-router has a method addRoutes that allows to dynamically add routes. However, it is currently not possible to add child routes to an existing route as far as I can see. It would be nice if addRoutes could have a second parameter parent or if you could introduce a new addChildRoutes method.

What I am trying to achieve is create a route for a product, let's say '/products/productA' pointing to a component that dynamically adds child routes in its beforeCreate so that in the end, I can navigate to '/products/productA/settings', '/products/productA/dashboard' etc. without the main router config knowing about every route each product has.

What is expected?

addRoute should offer a second parameter called parent so one can add child routes

What is actually happening?

addRoute does not support adding child routes to routes already defined

@posva
Copy link
Member

posva commented Jan 25, 2018

Duplicate of #1156

@posva posva marked this as a duplicate of #1156 Jan 25, 2018
@posva posva closed this as completed Jan 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants