vue 使用element 刷新保持当前路由状态

  <el-menu :default-active="$route.path" router  mode="horizontal">
        <el-menu-item v-for="route in routes" :key="route.path" :index="route.path" :class="$route.path==route.path?'is-active':''">{{route.name}}</el-menu-item>
   </el-menu>

js:

routes: [
    { path: '/main/kdgadmin', name: '幼儿园管理', },
    { path: '/main/phyex', name: '体测', },

    ]

css:
.is-active{
        background: #a3212f;
        border-bottom: 0px solid transparent;
        color: #FFFFFF;
    }

猜你喜欢

转载自blog.csdn.net/qq_37818095/article/details/81131905
今日推荐