Automatically add active
class to links like vue-router
#1811
mrleblanc101
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm reading the documentation, and I see that you need to manually add the active class to every link.
<Link href="/users" :class="{ 'active': $page.url === '/users' }">Users</Link>
This feels redundant. Wouldn't it be nice if it would be automatic ?
Vue-router automatically add
router-link-exact-active
when the linkhref
exactly match the the URL androuter-link-active
when it match a part of the URL.People can always add a custom class if they want a different matching behavior.
Beta Was this translation helpful? Give feedback.
All reactions