vuejs <router-link> component keeps the link to the root path always active
The root link is always active, because Vue Router partially matches the root /
path with the current path.
To perform an exact match you can either:
Add an
exact
attribute to therouter-link
:<router-link tag="li" to="/" exact> <a href="#"> Home </a></router-link>
- Set your active class in the
linkExactActiveClass
router constructor option instead oflinkActiveClass
.