第一种方式:在router中全局设置

export default new Router({
mode:'history',
linkActiveClass:'index',
routes: [
{
path: '/',
name: 'index',
redirect:{
path:'/home'
}
},
{
path: '/home',
name: 'home',
component: Home
}
]
})

vue设置选中时的样式名称-LMLPHP

第二种方式:在单条路由中设置 active-class

<router-link :to="{name:'home'}" event="mouseover" active-class="homeActive">
home
</router-link>

vue设置选中时的样式名称-LMLPHP

05-28 19:14