Skip to content

Adhoc Routing: add route dynamically #1083

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

Closed
li3p opened this issue Jan 8, 2017 · 5 comments
Closed

Adhoc Routing: add route dynamically #1083

li3p opened this issue Jan 8, 2017 · 5 comments

Comments

@li3p
Copy link

li3p commented Jan 8, 2017

Hi, All. By digging into the document and examples of 2.x version. I found I have to determine every route before router = new VueRouter(routes). I have a situation that some routes need to be added according to some ajax request's result. Can vue-router add a function to support this feature (in some Vue components method):

...
this.$router.on(url, component)
...
@znck
Copy link
Member

znck commented Jan 8, 2017

What do you need dynamic routes for?

@li3p
Copy link
Author

li3p commented Jan 9, 2017

Well, It is a document collaboration SPA, a number of people may editing a different pages of one document simultaneously. Each page is a node of the tree control in sidebar on every pages in editing. I need when someone added pages or changed the page title, each tree control on other pages can be updated simultaneously, and bind to a dynamically.

@znck
Copy link
Member

znck commented Jan 9, 2017

I think something like /pages/:page can work. If you need different component for different values of page then use a functional component.

Does this solve your issue?

@nkostadinov
Copy link

I have the same problem with ajax response which "needs" to modify routes #888 and #954

@posva
Copy link
Member

posva commented Jan 9, 2017

Closed in favour of #888

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

4 participants