Element中的meau的图标高亮显示

先列出关键代码

html 复制代码
.el-submenu__title:hover i{
  color: white !important;
}

本页全部代码

html 复制代码
<script>

</script>

<template>
  <div>
    <el-container>
      <!--    侧边栏-->
      <el-aside style="width: 200px;min-height: 100vh;background-color: #001529; border-radius: 4px;">
<!--        这里,min-height: 100vh;可以设置侧边栏的高度,默认是100%,这样可以充满整个页面。,同时,就可以把滚动条去掉-->
        <div style="height: 60px; line-height: 60px; color: white; display: flex; justify-content: center; align-items: center;">
          logo
        </div>

        <el-menu active-text-color="white" text-color="rgba(255,255,255,0.65)" background-color="#001529" router style="border: none;" :default-active="$route.path">
          <el-menu-item index="/">
            <i class="el-icon-house"></i>
            <span>系统首页</span>
          </el-menu-item>
          <el-menu-item index="/element">element首页</el-menu-item>
          <el-menu-item>系统首页</el-menu-item>
          <el-menu-item>系统首页</el-menu-item>
          <el-submenu>
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>系统设置</span>
            </template>
            <el-menu-item>信息管理</el-menu-item>
            <el-menu-item>管理员信息</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <!--    主体内容-->
      <el-container>
        <el-header>
          头部

        </el-header>

        <el-main>
          主体
          <router-view></router-view>
        </el-main>
      </el-container>

    </el-container>
  </div>
</template>

//样式不生效,直接无脑加一个 !important  解决
<style>
.el-menu--inline .el-menu-item{
  background-color: #000c16 !important;
}
.el-menu-item:hover,.el-submenu__title:hover{
  color: white !important;
}
.el-submenu__title:hover i{
  color: white !important;
}
</style>

注意点:

下面的写法只有鼠标放在,图标(i)上门的时候才会显示高亮,这与我们的需求:鼠标移动到一个上的时候,里面的东西全部高亮不是一个效果

html 复制代码
.el-submenu__title>i:hover{
  color: white !important;
}
相关推荐
A黄俊辉A2 天前
uniapp webview中实现 app和内嵌的H5双向通信
vue.js·json
三十而立洋2 天前
Cookie 详解:从产生到安全,一次讲透
前端·javascript
卡布鲁2 天前
把一个 Vite + Vue3 应用塞进 qiankun (React + Umi3) 主站:十个坑的复盘
前端·javascript·react.js
李少兄2 天前
JavaScript 隐式全局变量解析
javascript
honkun62 天前
vue 表格组件 vxe-table 配置 ajax 请求自动加载数据与表单查询
vue.js·vxe-table
kybs19912 天前
全球灾害数据分析可视化 毕业设计-附源码66794
vue.js·spring boot·mysql·安全·django·c#·asp.net
雪芽蓝域zzs2 天前
第26章:ECharts 自定义主题 + 页面一键切换主题(深色 / 浅色两套)
vue.js·echars
雪芽蓝域zzs2 天前
第22章:ECharts 图表联动(多图表交互联动)
vue.js·echars
daols882 天前
vue 表格组件 vxe-table 实现虚拟滚动与无需滚动加载
vue.js·vxe-table
雪芽蓝域zzs2 天前
第18章:ECharts 折线图 + 标记点、标记线,自定义 tooltip
vue.js·echars