15-5 激活active

在router下的index.js下使用 linkActiveClass: ‘active’,这样router-link链接下的router-link-exact-active的active就会被激活。就可以通过设置标签下的active的css样式来控制当前的样式。

export default new Router({
    linkActiveClass: 'active',
    routes
});

 .tab-item{
      flex: 1;
      text-align: center;
      &>a{
        display: block;
        font-size: 14px;
        color: rgb(77, 85, 93);
        &.active{
          color: rgb(240, 20, 20);  //active的标签颜色变红
        }
      }
    }

猜你喜欢

转载自blog.csdn.net/qq_39273455/article/details/88796216