修改导航栏样式时el-menu-item和el-submenu有区别(如图):
el-menu-item在scoped中设置值是可以的,而el-submenu在scoped中设置值不起作用
el-submenu的代码不能包含在scoped
<style lang="less">
//设置了默认左边框为白色
.el-submenu .el-submenu__title{
border-left: #fff solid 6px;
}
//设置鼠标悬停时el-submenu的样式
.el-submenu .el-submenu__title:hover{
border-left: #33A2EF solid 6px !important;
background-color: #E2EFF9 !important;
color: #38B2FF !important;
i {
color: #38B2FF;
}
}
</style>
el-menu-item的代码
<style lang="less" scoped>
//设置了默认左边框为白色
.el-menu-item{
border-left:#fff solid 6px;
}
//设置鼠标悬停时el-menu-item的样式
.el-menu-item:hover{
border-left:#33A2EF solid 6px !important;
background-color: #E2EFF9 !important;
color: #38B2FF !important;
//less语法,实现鼠标悬停时icon变色
i {
color: #38B2FF;
}
}
//设置选中el-menu-item时的样式
.el-menu-item.is-active {
border-left:#33A2EF solid 6px !important;
background-color: #E2EFF9 !important;
color: #38B2FF !important;
}
</style>
点赞、收藏的人已经开上兰博基尼了 (´▽`ʃ♡ƪ)
转载请注明出处!!!