您的位置:首页 > 产品设计 > UI/UE

element-UI tree树形控件 修改小三角图标

2020-07-14 04:40 2146 查看

el-tree 默认样式


可以看到有下级没展开是▸ 有下级展开了是▾ 没有下级的前面什么符号也没有。

更改成自定义样式

因为是vue的 <style scoped>内写CSS 样式,所以需要添加 /deep/ 进行穿透

.el-tree /deep/ .el-tree-node__expand-icon.expanded
{
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
//有子节点 且未展开
.el-tree /deep/ .el-icon-caret-right:before
{
background: url("./images/folder.png") no-repeat 0 3px;
content: '';
display: block;
width: 16px;
height: 16px;
font-size: 16px;
background-size: 16px;
}
//有子节点 且已展开
.el-tree /deep/ .el-tree-node__expand-icon.expanded.el-icon-caret-right:before
{
background: url("./images/folderOpen.png") no-repeat 0 3px;
content: '';
display: block;
width: 16px;
height: 16px;
font-size: 16px;
background-size: 16px;
}
//没有子节点
.el-tree /deep/.el-tree-node__expand-icon.is-leaf::before
{
background: url("./images/file.png") no-repeat 0 3px;
content: '';
display: block;
width: 16px;
height: 16px;
font-size: 16px;
background-size: 16px;
}

图片来自 Iconfont-阿里巴巴矢量图标库

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: