zoukankan      html  css  js  c++  java
  • vue-router active-class 进入当前菜单的样式

    App.vue

    <template>
      <div id="nav">
        <!-- 导航 -->
        <router-link to="/" active-class="current">Home</router-link> |
        <router-link to="/about" active-class="current">About</router-link> |
        <router-link to="/test1_bak">Test1_bak</router-link> |
        <router-link to="/test1">Test1</router-link> |
        <router-link to="/test2">Test2</router-link>
      </div>
      <!-- 路由出口 -->
      <router-view/>
    </template>
    
    <style>
    #app {
      font-family: Avenir, Helvetica, Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-align: center;
      color: #2c3e50;
    }
    
    #nav {
      padding: 10px;
      background-color: lightskyblue;
    }
    
    #nav a {
      font-weight: bold;
      color: #2c3e50;
    }
    
    /* 默认选中样式类 */
    #nav a.router-link-exact-active {
      color:orangered;
    }
    
    .current{
      font-size: 24px;
      font-weight: bolder;
    }
    </style>

    index.js

    const router = createRouter({
      history: createWebHashHistory(),
      linkActiveClass:'current',
      routes
    })
  • 相关阅读:
    bzoj3622: 已经没有什么好害怕的了
    BSGS
    LOJ#2320 生成树计数
    ??? cliquers
    生成函数
    洛谷P5206 数树
    01分数规划
    差分约束系统
    51nod1238 最小公倍数之和 V3
    51nod1237 最大公约数之和 V3
  • 原文地址:https://www.cnblogs.com/mingforyou/p/15210088.html
Copyright © 2011-2022 走看看