当前位置: 首页 > news >正文

【element树组件】el-tree实现连接线及hover编辑效果

如图,禁止废话,直接上代码
在这里插入图片描述

            <div class="bg-white h-full common-border-radius" style="padding: 20px 20px 20px 0; width: 400px; min-width: 300px; overflow: scroll;"><el-treev-loading="treeLoading"class="tree-contianer":data="treeData"default-expand-allnode-key="id"ref="tree"highlight-current:indent="0":expand-on-click-node="false":props="defaultProps"@node-click="(data, node) => handleTreeNodeClick(data, node)"><span class="custom-tree-node" slot-scope="{ node, data }" ><el-tooltip effect="dark" :disabled="!data.showTitle" :content="data.showTitle ? node.label : ''" placement="top"><span style="font-size: 14px;" @mouseenter="el => handleMouse(el, data)">{{ node.label }}</span></el-tooltip><span class="tree-node-opt"><el-tooltip class="item" effect="dark" :content="$t('common.edit')" placement="top"><el-buttontype="text"size="mini"@click.prevent.stop="() => handleEditDept(data)"icon="el-icon-edit"></el-button></el-tooltip><el-tooltip class="item" effect="dark" :content="$t('common.delete')" placement="top"><el-buttontype="text"size="mini"@click.prevent.stop="() => handleDelDept(data)"icon="el-icon-delete"></el-button></el-tooltip><el-tooltip class="item" effect="dark" :content="$t('common.add')" placement="top"><el-buttontype="text"size="mini":disabled="node.level > 6"@click.prevent.stop="() => handleAddDept(data)"icon="el-icon-plus"></el-button></el-tooltip></span></span></el-tree></div>
<style lang="scss">
.tree-contianer {/* 覆盖 el-tree 的默认样式 */.el-tree-node__content:hover {.el-button--text {color: #2F3133;}}.tree-node-opt {margin: 0 0 0 10px;.el-button--text {color: #dddddd;}}.el-tree-node {position: relative;padding-left: 16px;&::before {content: '';width: 1px;height: 100%;border-left: 1px solid #eeeeee;position: absolute;left: -4px;top: -26px;}&::after {content: '';width: 20px;height: 20px;border-top: 1px solid #eeeeee;position: absolute;top: 12px;left: -4px;}&:last-child:before {height: 38px;}.el-tree-node__children {padding-left: 16px;}.el-tree-node__expand-icon.is-leaf {display: none;}}& > .el-tree-node:before {border-left: none;}& > .el-tree-node:after {border-top: none;}
}
</style>
http://www.xdnf.cn/news/1288513.html

相关文章:

  • Java进阶学习之不可变集合
  • Ubuntu与Rocky系统安装Java全指南
  • 《软件工程导论》实验报告一 软件工程文档
  • 基于LLVM的memcpy静态分析工具:设计思路与原理解析(C/C++代码实现)
  • Life:Internship in OnSea Day 50, 51
  • 11. React组件插槽用法
  • Flink Python API 提交 Socket 数据源的 WordCount 作业
  • uni-app实战教程 从0到1开发 画图软件 (学会画图)
  • Flutter UI Kits by Olayemi Garuba:免费开源的高质量UI组件库
  • nvm install 14.21.3 时npm 无法下载和识别
  • -bash: ./restart.sh: /bin/bash^M: 坏的解释器: 没有那个文件或目录
  • 1.Ansible 自动化介绍
  • 串口通信“第二次总超时”的复盘
  • ETCD备份
  • aspose word for java 使用书签进行内容填充和更新
  • SM4对称加密算法的加密模式介绍
  • Python Day28 HTML 与 CSS 核心知识点 及例题分析
  • 自动驾驶 HIL 测试:构建 “以假乱真” 的实时数据注入系统
  • 《嵌入式Linux应用编程(四):Linux文件IO系统调用深度解析》
  • GraphQL 原理、应用与实践指南
  • 【Altium designer】快速建立原理图工程的步骤
  • Day05 店铺营业状态设置 Redis
  • MySQL-多表查询
  • 第23章,景深:技术综述
  • 下一代防火墙技术
  • 【KO】android 面试 算法
  • 数字气压传感器,筑牢汽车TPMS胎压监测系统的精准感知基石
  • 西门子S7-200与S7-1200通过PPI以太网模块通讯,赋能汽车制造行业发展
  • 如何在 Ubuntu 24.04 LTS Linux 中安装 JSON Server
  • WebAssembly的原理与使用