原生: image.png修改tree点击时及失焦时的背景颜色
修改后: image.png
<!-- highlight-current 要添加高亮属性 -->
<el-tree ref="treeForm" current-node-key node-key="depart_id" :data="list" :props="defaultProps" @node-click="handleNodeClick" ></el-tree>
<style scoped lang='scss'>
/* 改变被点击节点背景颜色,字体颜色 */
.el-tree-node:focus > .el-tree-node__content {
background-color: #4a9de7 !important;
color: #fff !important;
}
/*节点失焦时的背景颜色*/
.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content{
background-color: #4a9de7 !important;
color: #fff !important;
}
</style>
网友评论