当前位置:   article > 正文

elementUI树形组件添加连接线(附效果图)_element 树形控件 线段连接

element 树形控件 线段连接

先看效果图: 

 

 

  1. <div class="tree-container">
  2. <el-tree
  3. :data="treeData2"
  4. :highlight-current="true"
  5. node-key="lc_id"
  6. default-expand-all
  7. draggable
  8. :allow-drop="allowDrop"
  9. @node-drag-end="handleDragEnd"
  10. @node-click="handleNodeClick"
  11. class="tree"
  12. ref="tree"
  13. >
  14. <template v-slot:default="{ node }">
  15. <div class="flex-tree">
  16. <div>
  17. <el-icon v-show="node.data.children && node.data.children.length">
  18. <l-calendar />
  19. </el-icon>
  20. {{ node.label }}
  21. </div>
  22. <div v-show="node.data.lc_id !== 'container'">
  23. <el-icon @click.stop="delNode(node)"><l-delete /></el-icon>
  24. </div>
  25. </div>
  26. </template>
  27. </el-tree>
  28. </div>
  1. /* 树形结构节点添加连线 css */
  2. .tree .el-tree-node {
  3. position: relative;
  4. // padding-left: 16px;
  5. }
  6. .tree .el-tree-node__children {
  7. padding-left: 16px;
  8. }
  9. .tree .el-tree-node :last-child:before {
  10. height: 38px;
  11. }
  12. .tree .el-tree > .el-tree-node:before {
  13. border-left: none;
  14. }
  15. .tree-container .el-tree > .el-tree-node:after {
  16. border-top: none;
  17. }
  18. .tree .el-tree-node__children .el-tree-node:before {
  19. content: "";
  20. left: -4px;
  21. position: absolute;
  22. right: auto;
  23. border-width: 1px;
  24. }
  25. .tree .el-tree-node:after {
  26. content: "";
  27. left: -4px;
  28. position: absolute;
  29. right: auto;
  30. border-width: 1px;
  31. }
  32. .tree .el-tree-node__expand-icon.is-leaf {
  33. display: none;
  34. }
  35. .tree .el-tree-node:before {
  36. border-left: 1px dashed #dddddd;
  37. bottom: 0px;
  38. height: 100%;
  39. top: -26px;
  40. width: 1px;
  41. }
  42. .tree .el-tree-node:after {
  43. border-top: 1px dashed #dddddd;
  44. height: 20px;
  45. top: 12px;
  46. width: 24px;
  47. }
  48. .tree .custom-tree-node {
  49. padding-left: 10px;
  50. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/322464
推荐阅读