Closed
Description
Consider the following snippet:
<router-link :to="{name: 'home'}" exact>Home</router-link>
<router-link to="/user">/user (2) </router-link>
<router-link :to="{name: 'user'}">user (named route) (3) </router-link>
<router-view></router-view>
const router = new VueRouter({
mode: 'history',
routes: [
{
path: '/user',
component: User,
children: [
{
path: '',
name: 'user',
component: UserHome
}
]
},
{
path: '',
name: 'home',
component: Home,
}
]
});
Example here - click on the link (2), then click on the Home
and finally click on the link (3).
Notice that the link (2) and link (3) are 'exact' same routes. But they both don't get the active-class
at the same time if you click on the link (2).
However the active-class
is added to both of them by clicking on the link (3).
That is because of the trailing slash /
on the (3) link I guess.