vue 基于elment UI tree 组件实现带引导、提示线怎么写

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

 

<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;
  }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值