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;
}
相关推荐
@atweiwei2 小时前
LangChainRust 0.33.0 发布:让 Agent 应用更容易运行、观察和评测
服务器·前端·javascript
AI开源软件6 小时前
用MQTT跑通一台模拟设备:看懂IoT产品、物模型和告警
java·vue.js·spring boot·物联网·mqtt·iot·企业管理
qq_274475158 小时前
第 28 篇:Promise 全解析:状态、then/catch/finally、静态方法 all/race/allSettled/any
开发语言·javascript
GuWenyue10 小时前
昵称限 20 字,8 个 emoji 却超长:一个「字」在系统里有四种长度
javascript·数据库·后端
画中有画12 小时前
自动化脚本中使用RSA
前端·javascript·自动化
只睡四小时14 小时前
AI 写的倒计时:Electron 每轮吞 0.8 秒
javascript·人工智能·性能优化·electron·时间管理·番茄钟
全速向光14 小时前
用 Three.js 从零打造一棵会发光的 3D 圣诞树
开发语言·javascript·3d
布语world14 小时前
某东pc滑块分析
前端·javascript·网络·python·安全
map_vis_3d15 小时前
百度地图自定义覆盖物 CustomOverlay:用 HTML、React、Vue 组件做标注
前端·javascript·vue·react·百度地图
变与不变80616 小时前
js数据流
前端·javascript