-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Expose meta in Route objects #602
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
Conversation
Expose route.meta to allow reading RouteConfig.meta in transition hooks. Reasons: In 1.0, we used to pass Custom Fields( like `auth` in route configs, as the [document](http://router.vuejs.org/en/route.html#custom-fields) suggested), but in 2.0 these custom fields aren't exposed in `route` object. I've noticed that in `RouteConfig`, there is an optional field `meta`, which i guess serves the functionality of the previous Custom Fields, judging from the fact that 1). It's type is any 2).there are no references of it in the source code. So I guess `meta` should be exposed in route objects, otherwise there is no need to define it in the first place.
You already can access In the next branches examples, there's already an example using the meta property: set meta: |
@LinusBorg meta's not accessible in $route, unfortunately.. |
it's accessible through the routeRecord objects in the This has the added benefit of providing access to the parent routeRecord's meta, as well. |
@LinusBorg Thanks! I wasn't looking inside |
@fnlctrl note the |
@yyx990803 I see...Thanks for the note! |
Expose route.meta to allow reading RouteConfig.meta in transition hooks.
Reasons:
In 1.0, we used to pass Custom Fields( like
auth
in route configs, as the document suggested), but in 2.0 these custom fields aren't exposed inroute
object.I've noticed that in
RouteConfig
, there is an optional fieldmeta
, which i guess serves the functionality of the previous Custom Fields, judging from the fact that 1). It's type is any 2).there are no usage references of it in the source code.So I guess
meta
should be exposed in route objects, otherwise there is no need to define it in the first place.