记录使用vue-element-admin框架

1.左侧菜单选中样式问题
在SidebarItem,vue文件中新增style样式

<style scoped>
/* 设置选中后的菜单背景颜色 */
 .el-menu-item.is-active{ 
  /*一级*/
  background: #4D67DF !important;
}
#app .sidebar-container .nest-menu .el-submenu > .el-submenu__title, #app .sidebar-container .el-submenu .el-menu-item.is-active{
 /*一级以外*/
  background: #4D67DF !important;
}
</style>

2.处理3级菜单只有一个页面时不显示问题

创建一个二级菜单,设置不显示在侧边栏,把三级页面放里面就ok了在这里插入图片描述

  {
    path: '/studentList',
    component: Layout,
    alwaysShow: true,
    redirect: '/studentList/index',
    meta: { title: '学员管理', icon: 'student' },
    children: [
      {
        path: 'index',
        name: 'studentList',
        component: () => import('@/views/studentList/index'),
        meta: { title: '学员列表' ,icon:'none' },
      },
      { //新建的二级。要跳转的三级写在这里
        path: 'index',
        name: 'studentList',
        component: () => import('@/views/studentList/indexI'),
        meta: { title: '学员列表' ,icon:'none' },
        hidden:true,
        children:[
          {
            path: '/studentList/editStuden',
            name: 'editStuden',
            component: () => import('@/views/studentList/editStuden/index'),
            meta: { title: '编辑资料' ,icon:'none'},
            hidden:true
          }
        ]
      }
    ]
  },




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值