Closed AntonioDell closed 2 months ago
This is the intended behavior, it allows to show the route without its children and it's more flexible
@posva I can understand that reasoning, but this is not really clear from the docs. Maybe a hint to this behavior would be nice to add to f.e. https://router.vuejs.org/guide/essentials/named-views.html
Totally, added to https://github.com/vuejs/router/discussions/2068
Reproduction
https://github.com/AntonioDell/vue-router-name-bug
Steps to reproduce the bug
pnpm install
pnpm dev
About (navigation by path to "/about")
about.child
with the componentAboutChildView.vue
is shownAbout (navigation by name)
about.child
with the componentAboutChildView.vue
is NOT shownExpected behavior
I would expect navigation by name to behave exactly as navigation by path. The default child route with path
path: ""
should be shown regardless if I useto="/about"
or:to="{name: 'about'}"
.Actual behavior
The default child route with path
path: ""
is not shown, when defining a RouterLink like this:<RouterLink :to="{ name: 'about' }">About</RouterLink>
with a router definition like this:
Additional information
EDIT: I also noticed, that the links actually look the same in the DOM. So this makes it more apparent, that this is a bug.![grafik](https://github.com/vuejs/router/assets/29783330/07659f73-bf11-4fa0-a3bb-a185274aef17)