我这里是遇到了vue中使用element的tree组件,发现鼠标点击和悬浮在tree上时,tree的背景变成白色了
一开始直接用css对象重新改变样式,发现无效,即使是用!important也无效,先贴代码
.box_Video_list {
height: 1041px;
.el-tree {
background: none;
color: rgba(255, 255, 255, 0.8);
font-size: 14px;
font-family: PingFangSC, PingFangSC-Regular;
.el-icon-caret-right:before {
color: #657180;
}
}
::v-deep .el-tree {
// background-color: #f5f5f5;
}
::v-deep.el-tree-node__content {
&:hover {
background-color: rgba(255, 255, 255, 0.1) !important;
}
}
::v-deep.el-tree-node.is-current > .el-tree-node__content {
background-color: rgba(255, 255, 255, 0.3) !important;
}
}
后面加了穿透::v-deep才生效
这里的style lang=“less” ,记得给style加上scoped属性,不然::v-deep也无效