action-class路由激活

182 阅读1分钟

形式:当点击一个路由链接,这个链接呈现高亮状态

先在要高亮的地方添加类名active-class,来改变被激活的链接的样式

//html
<router-link to="/labels" class="item" active-class="selected">
  <div class="item-content">
    <Icon name="Label"/>
    标签
  </div>
</router-link>
//css
.item.selected{
  color:#F3AFAC;
  font-weight: bold;
  &:nth-child(2){
    color:#fff;
  }
}