Vue Router active-class 属性

active-class 是 vue-router 模块的 router-link 组件的属性,当 router-link 标签被点击时将会应用这个样式。

  • 单独在 router-link 标签上使用 active-class 属性
  • <router-link to="/about" active-class="active">about</router-link>

    最后,为您选中的链接设置样式:

  • a.router-link-exact-active {
      color: plum;
    }
     
    .active {
      font-size: 16px;
      font-weight: bold;
    }

    点击后,无论怎么刷新页面,样式效果都不会去掉,除非跳转到其他页面。。(这一点还挺不错)

猜你喜欢

转载自blog.csdn.net/m0_70547044/article/details/132447524
今日推荐