-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
docs: add 'Active links' #2183
docs: add 'Active links' #2183
Conversation
✅ Deploy Preview for vue-router ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks again! I'm wondering if we should name the page something else that includes active/matching. We could even omit the RouterLink keyword. So maybe, just "Active Links" works better. What do you think?
I think it's fine leaving it out as most people won't have a route that can be visited directly while having a child with path ''. |
We might be thinking of slightly different edge cases. To clarify, the specific edge case I'm most concerned about is the one shown here: The routes here are: const routes = [
{
path: '/user',
children: [
{
path: '',
name: 'A',
component: UserView
}, {
path: 'roles',
name: 'B',
component: UserRolesView
}
]
}
] Route A is a sibling of route B, not an ancestor, yet it is shown as active when the current location is When I was writing my description of how 'active' is defined, I stayed clear of mentioning |
Yeah, I think that makes sense. I've also renamed the first section heading so it doesn't clash with the main heading. |
Ah i see now what you meant. It would be inconvenient if it was the other way around but it doesn’t for against the idea of the matched array |
* docs: add RouterLink classes * Rename page to 'Active links'
* docs: add 'Active links' (vuejs#2183) * docs: add RouterLink classes * Rename page to 'Active links' * docs: update certificate links
This adds a page explaining the RouterLink classes.
This currently isn't covered in the main guide. It is mentioned in the migration guide for the
exact
prop. There's also an explanation in the related RFC.I've put it near the end of the Essentials section. It mentions
alias
andredirect
, so it needed to come after those are introduced. Putting it after the guide to passing props was an arbitrary choice, it could just as easily have gone before.There's already an advanced guide to Extending RouterLink. That page seems to assume that people are already familiar with the existing RouterLink classes and the related concepts of active and exact. This new page covers those topics.
I haven't covered the edge case around the handling of a
path: ''
on children. I could try to add something about that, though I'm not sure whether it would be more confusing than helpful.