准备工作,先实现 树状组件的基本样式

      <span style="height:500px; display:block; overflow-y:auto;" class="mytree">
<el-tree
:data="data"
show-checkbox
:indent="0"
node-key="id"
:default-expand-all="true"
:props="defaultProps"
></el-tree>
</span>

  

 接下来修改css ,注:indent 设置为零,不然线与节点间的间隙会比较大, 我使用的是 scss,less 也行

  .mytree /deep/ {
.el-tree > .el-tree-node:after {
border-top: none;
}
.el-tree-node {
position: relative;
padding-left: 16px;
}
//节点有间隙,隐藏掉展开按钮就好了,如果觉得空隙没事可以删掉
.el-tree-node__expand-icon.is-leaf {
display: none;
}
.el-tree-node__children {
padding-left: 16px;
} .el-tree-node :last-child:before {
height: 38px;
} .el-tree > .el-tree-node:before {
border-left: none;
} .el-tree > .el-tree-node:after {
border-top: none;
} .el-tree-node:before {
content: '';
left: -4px;
position: absolute;
right: auto;
border-width: 1px;
} .el-tree-node:after {
content: '';
left: -4px;
position: absolute;
right: auto;
border-width: 1px;
} .el-tree-node:before {
border-left: 1px solid #c0c4cc;
bottom: 0px;
height: 100%;
top: -26px;
width: 1px;
} .el-tree-node:after {
border-top: 1px solid #c0c4cc;
height: 20px;
top: 12px;
width: 24px;
}
}

  完,大功告成!

最新文章

  1. 【转】搞不清FastCgi与php-fpm之间是个什么样的关系?
  2. Reader与InputStream两个类中的read()的区别
  3. Android 广播 BroadcastReceiver
  4. 摘记 史上最强大的40多个纯CSS绘制的图形(一)
  5. 解压版mysql安装
  6. ehcache2.8.3入门示例:hello world
  7. Struts2中上传图片案列
  8. scst使用的一些问题
  9. 电商ERP如何接入智选物流平台?
  10. 使用Git push时出现的一些问题处理
  11. COJN 0487 800301红与黑
  12. Shuffle 的 5步
  13. 总账追朔各模块SQL
  14. Shell命令-文件及内容处理之vi、vim
  15. IISExpress使用64位
  16. PostgreSQL条件表达式 case when then end
  17. Core Mvc传值Query、Form、Cookies、Session、TempData、Cache
  18. 【Core】.NET Core 部署( Docker + CentOS)
  19. ECMAScript 6 入门之新的数据类型Symbol
  20. Perl关联数组用法集锦

热门文章

  1. RF(ride 工具使用)
  2. Android 10 获取已连接上的蓝牙设备的当前电量
  3. JMeter Nmon Tool V2.0 插件
  4. 解决python语言的工具pycharm以及Windows电脑安装pygame模块的问题
  5. 内存淘汰机制——LRU与LFU
  6. Tomcat Ghostcat - AJP协议漏洞DEBUG
  7. README.md编写
  8. Day_12【集合】扩展案例3_产生10个长度为10,不能重复,由数字0-9,小写字母和大写字母组成的字符串
  9. HttpClient之Post接口代码范例
  10. 如何将Altera官方提供的CADENCE.OLB应用于altium Designer中