当前位置:   article > 正文

element带线树_element-tree-line

element-tree-line

主要就是这种样式     

 

是用的elementui里的el-tree 然后通过伪类的编辑获得当前树

代码:(/deep/放在.vue文件会报错,可以提出来css)

  1. <template>
  2. <div>
  3. <div class="hello">
  4. <el-tree
  5. :data="treeData"
  6. :props="defaultProps"
  7. default-expand-all
  8. :expand-on-click-node="false">
  9. </el-tree>
  10. </div>
  11. </div>
  12. </template>
  13. <style lang="scss" scoped>
  14. /deep/ .hello {
  15. .el-tree > .el-tree-node > .el-tree-node__content:first-child {
  16. &::before,
  17. &::after {
  18. border: none;
  19. }
  20. }
  21. .el-tree-node .el-tree-node__content {
  22. height: 30px;
  23. &::before,
  24. &::after {
  25. content: "";
  26. position: absolute;
  27. right: auto;
  28. }
  29. &::before {
  30. border-left: 1px solid #e6e6e6;
  31. bottom: 50px;
  32. height: 100%;
  33. top: 0;
  34. width: 1px;
  35. margin-left: -5px;
  36. margin-top: -15px;
  37. }
  38. &::after {
  39. border-top: 1px solid #e6e6e6;
  40. height: 20px;
  41. top: 14px;
  42. width: 10px;
  43. margin-left: -5px;
  44. }
  45. }
  46. .el-tree .el-tree-node {
  47. position: relative;
  48. }
  49. }
  50. </style>
  51. <script>
  52. export default {
  53. name: 'hello',
  54. data () {
  55. return {
  56. treeData: [
  57. {
  58. id: 1,
  59. name: '技术部',
  60. level: 1,
  61. child: [
  62. {
  63. id: 2,
  64. name: '运维组',
  65. level: 2,
  66. child: [
  67. {
  68. id: 3,
  69. name: '测试',
  70. level: 3,
  71. child: [
  72. {
  73. id: 4,
  74. name: '前端',
  75. level: 4,
  76. child: [
  77. {
  78. id: 4,
  79. name: '前端',
  80. level: 4
  81. }
  82. ]
  83. }
  84. ]
  85. },
  86. {
  87. id: 4,
  88. name: '前端',
  89. level: 4
  90. }
  91. ]
  92. },
  93. {
  94. id: 4,
  95. name: '测试组',
  96. level: 2,
  97. child: []
  98. }
  99. ]
  100. }
  101. ],
  102. defaultProps: {
  103. children: 'child',
  104. label: 'name'
  105. }
  106. }
  107. }
  108. }
  109. </script>

 

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