zoukankan      html  css  js  c++  java
  • 使用element-ui的el-menu导航选中后刷新页面保持当前选中

         <el-menu :default-active=‘$route.path‘ :router=‘true‘ :unique-opened=‘true‘ :default-openeds="defaultOpeneds" 
            background-color="#bd1e22" text-color="#fff" active-text-color="#ffd04b">         
            //router当导航激活时允许以index作为路由进行页面的跳转,$route.path当前路由对象的路径,字符串,绝对路径         
            //unique-opened只允许有一个下拉菜单处于打开的状态         
            //使用default-active来实现当前菜单激活的选项
            //default-openeds当前打开的 sub-menu 的 index 的数组
    <el-menu-item index=‘/home‘>首页</el-menu-item>
                <el-submenu>
                  <template slot="title">
                    <i class=‘‘></i><span>导航一</span>
                  </template>
                  <el-menu-item index=‘/first/page1‘>
                    <template slot="title">
                      <i class=‘‘></i><span>选项一</span>
                    </template>
                  </el-menu-item>
                  <el-menu-item index=‘/first/page2‘>
                    <template slot="title">
                      <i class=‘‘></i><span>选项二</span>
                    </template>
                  </el-menu-item>
                </el-submenu>
            </el-menu
    >
         mounted(){
                let path = this.$route.path;
                this.navConfig = [
                    {index:'1',path:['/system/aa','/system/bb','/system/cc']},
                ];
                let thisNav = this.navConfig.find(item =>{
                    return item.path.includes(path);
                });
                this.defaultOpeneds = [thisNav.index];
            }
  • 相关阅读:
    poj 3278 Catch That Cow(bfs+队列)
    poj 1265 Area(Pick定理)
    poj 2388 Who's in the Middle
    poj 3026 Borg Maze(bfs+prim)
    poj 2485 Highways
    变量引用的错误:UnboundLocalError: local variable 'range' referenced before assignment
    Sysbench硬件基准测试
    Sysbench-OLTP数据库测试
    字典
    操作列表
  • 原文地址:https://www.cnblogs.com/gxp69/p/11212232.html
Copyright © 2011-2022 走看看