el-menu彈出菜單樣式不生效的問題及解決方法
1. 使用 ruoyi 項目時出現(xiàn)的問題。
<template>
<el-menu
:default-active="activeMenu"
:collapse="false"
:unique-opened="true"
class="container"
:collapse-transition="true"
mode="horizontal"
>
<sidebar-item
v-for="(route, index) in sidebarRouters"
:key="route.path + index"
:item="route"
:base-path="route.path"
/>
</el-menu>
</template>class=“container” 中的樣式是這樣的
.container {
box-shadow: 0px 1px 4px 0px rgba(0,0,0,0.1);
float: left;
height: 100%;
width: 200px;
background-color: transparent !important;
overflow: hidden;
-webkit-transition: width .28s;
transition: width 0.28s;
-webkit-box-shadow: 2px 0 6px rgba(0,21,41,.35);
box-shadow: 2px 0 6px rgba(0,21,41,.35);
.svg-icon {
margin-right: 10px;
margin-left: 3px;
}
// menu hover
.el-submenu__title {
font-size: 17px;
color: white !important;
&:hover {
background-color: transparent !important;
}
}
}2. 問題描述
.svg-icon 這個 樣式只對 一級菜單 “高速公路” 生效! 二級菜單和 其中的選項則不能生效!

3. 解決方法
html 文檔中 是沒有 彈出菜單項(出入口收費站 -> 總流量 。。。)的。

他們在 html 文檔的末尾可以看到

所以 根據(jù) 彈出菜單出現(xiàn)的位置 設置樣式就可以了!在 el-menu–popup這個樣式的基礎上作修改
.el-menu--popup {
.el-submenu__title{
background-color: #0B1423 !important;
color: #FFF !important;
}
.el-menu-item{
background-color: #0B1423 !important;
color: #FFF !important;
}
.el-menu-item:hover {
background-color: #FFF !important;
color: #0B1423 !important;
}
.el-menu-item.is-active {
background-color: #FFF !important;
color: #0B1423 !important;
}
.svg-icon {
margin-right: 10px;
margin-left: 3px;
}
}4. 總結
修改彈出框元素 不在 el-menu 樣式中,我們 需要在 el-menu–popup 中修改樣式!
到此這篇關于el-menu彈出菜單樣式不生效的文章就介紹到這了,更多相關el-menu彈出菜單內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
vue實現(xiàn)前端保持篩選條件到url并進行同步參數(shù)設計
這篇文章主要為大家介紹了vue實現(xiàn)前端保持篩選條件到url并進行同步參數(shù)設計思路詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-08-08
使用Vue3實現(xiàn)交互式雷達圖的代碼實現(xiàn)
雷達圖是一種可視化數(shù)據(jù)的方式,用于比較多個類別中不同指標的相對值,它適用于需要展示多個指標之間的關系和差異的場景,本文給大家介紹了如何用Vue3輕松創(chuàng)建交互式雷達圖,需要的朋友可以參考下2024-06-06

