-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
$route not updated across discrete components #1102
Comments
I think this is simply not supported, but I don't know if it would be easy to do. |
Currently a router instance can only be installed to one Vue instance, so the usage wasn't supported. Maybe we should throw an error for this? |
Yeah, if a |
Thanks for clarifying that this isn't intended to be a supported use case. @yyx990803 - when you say that creating multiple router instances is the way to achieve this, is there no concern about conflicts between the different router instances? eg. multiple instances doing things w/ the browser history api? @posva use case is creating a library where implementers can just plug different components into any part of a page. Along the lines of: if you decorate any DOM node with the Edit: just out of curiosity, would it be a breaking change to have a single router be shared across multiple Vue instances? I'd be happy to look into it and send a PR if it would be considered. |
@jhartman86 technically it should be possible to use the same router instance for multiple component trees, I don't see this bringing about a breaking change. |
Closed by merging #1108 - thanks! |
You guys rock. That was a pretty quick issue-filed-to-PR-accepted cycle, so thanks. Keep up the good work w/ VueJS - its a pleasure to use! |
Vue.js / vue-router versions
2.1.2 / 2.1.1
Reproduction Link
Steps to reproduce
vs this:
new BaseVue()
s), the $route object is only updated on the second instance (in the JSFiddle, its in the node where the<router-view />
is).What is Expected?
When a route change is triggered, the
$route
object should be updated on all Vue instances created bynew
'ing BaseVue, since BaseVue was created by injecting the router option.What is actually happening?
Only the instance where the
<router-view />
lives as a child has the$route
data properly updated.The text was updated successfully, but these errors were encountered: