Closed matthewrobb closed 4 years ago
Oh, interesting, would you provide a usage-sample of this? Thank you!
Basically similar to what happens now with let directives but I want to bind to a component local:
<script>let router;</script>
<Route bind:router />
I am using the router
export for now but they are different and in some cases it would be more useful to be able to bind to that activeRoute that is currently exposed on the slot and available as a let directive.
Still not sure what you're trying to achieve, but let me share what we have now:
You can use the $router
store at any component, even outside of any Router, e.g.
<script>
import { router } from 'yrv';
</script>
<pre>{JSON.stringify($router, null, 2)}</pre>
This object is very similar to what you get with let:router
inside components.
The activeRouter
object holds only the routeInfo per-each resolved route, it will look as activeRouter[route.key] = route;
since routes are identified by key.
I'm not sure if this information is useful outside, from this perspective activeRouter
will only tell you which routes are available to mount, and its params/props, etc.
Can you clarify why the latter one is what you want?
Hello!
Liking the library. Tried svero and couldn't make good sense of things, swapped in yrv and everything started making sense.
However I am interested in having activeRouter be an exported prop so that I can bind to it from the outside. Let me know how you feel about that and if desired I can submit a PR. Thanks!