一路繁花似锦绣前程
失败的越多,成功才越有价值

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
统计
 
<template>
  <el-tree :data="data" default-expand-all :props="defaultProps" @node-click="handleNodeClick" />
</template>

<script>
export default {
  name: 'Dashboard',
  data() {
    return {
      data: [
        {
          label: '一级 1',
          children: [{
            label: '二级 1-1',
            children: [{
              label: '三级 1-1-1'
            }]
          }]
        }, {
          label: '一级 2',
          children: [{
            label: '二级 2-1',
            children: [{
              label: '三级 2-1-1'
            }]
          }, {
            label: '二级 2-2',
            children: [{
              label: '三级 2-2-1'
            }]
          }]
        }, {
          label: '一级 3',
          children: [{
            label: '二级 3-1',
            children: [{
              label: '三级 3-1-1'
            }]
          }, {
            label: '二级 3-2',
            children: [{
              label: '三级 3-2-1'
            }, {
              label: '三级 3-2-2'
            }]
          }]
        }],
      defaultProps: {
        children: 'children',
        label: 'label'
      }
    }
  },
  methods: {
    handleNodeClick(data) {
      console.log(data)
    }
  }
}
</script>

<style lang="scss" scoped>
  .el-tree ::v-deep {
    .el-tree-node__content {
      position: relative;
    }

    .el-tree-node:last-child > .el-tree-node__content::before {
      content: "";
      width: 1px;
      height: 10000px;
      background-color: green;
      position: absolute;
      margin-left: -9px;
      bottom: 13px;
    }

    .el-tree-node__children .el-tree-node__content::after {
      content: "";
      width: 9px;
      height: 1px;
      background-color: red;
      position: absolute;
      margin-left: -9px;
    }

    .el-tree-node__content > .el-tree-node__expand-icon {
      padding: 6px 3px;
    }
  }
</style>
<!-- <style lang="scss" scoped>
  /* 方式二的思路 */
  .el-tree ::v-deep {
    .el-tree-node__children {
      padding-left: 24px;

      .el-tree-node::before {
        height: 100%;
        top: -26px;
      }

      .el-tree-node:last-child::before {
        height: 38px;
      }
    }
  }
</style> -->
posted on   一路繁花似锦绣前程  阅读(2518)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
历史上的今天:
2021-04-23 css点划线边框
 
点击右上角即可分享
微信分享提示