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

element-tree-line el-tree 添加结构线 添加虚线

概览:给element组件添加上虚线,通过使用插件element-tree-line

参考连接:

参考别人的博客

安装插件:

# npm
npm install element-tree-line -S

# yarn
yarn add element-tree-line -S

main.js全局注册引入插件:

 

import { getElementLabelLine } from 'element-tree-line';
import 'element-tree-line/dist/style.css';
const ElementLabelLine = getElementLabelLine(h);
app.component(ElementLabelLine.name, ElementLabelLine);

el-tree组件封装:

<template><el-tree ref="treeRef" class="tree-content" :data="props.treeData" node-key="id" :highlight-current="true":props="props.defaultProps" icon="none" :current-node-key='0' default-expand-all :indent="props.treeIndent"><template #default="{ node, data }"><element-tree-line :node="node" :showLabelLine="false" :indent="props.treeIndent"><template v-slot:node-label><div class="com-tree"><i v-if="data.children?.length > 0":class="node.expanded ? 'iconfont icon-pinleijianshao' : 'iconfont icon-pinleizengjia'"class="tree-icon"></i><span class="com-tree-text" @click="nodeClick(data)">{{ node.label }}</span></div></template></element-tree-line></template></el-tree>
</template><script setup>
let props = defineProps({ treeData: Array, defaultProps: Object, treeIndent: Number });
const emits = defineEmits(['nodeClick']);
const nodeClick = (data) => {emits('nodeClick', data);
};
</script>

el-tree页面组件使用:

 

<el-scrollbar><Tree :treeData="data.treeData" :defaultProps="defaultProps" :treeIndent="data.treeIndent"@nodeClick="hanleNodeClick"></Tree>
</el-scrollbar>

 效果展示:

 

http://www.lryc.cn/news/102846.html

相关文章:

  • 【Lua学习笔记】Lua进阶——函数和闭包
  • 大学生竞赛管理系统springboot比赛报名信息java jsp源代码mysql
  • UnixBench 5.1.3 银河麒麟桌面操作系统V10 (SP1) ARM64 aarch64 图形性能测试 2d 3d, glmark2 3d测试
  • JavaScript高级——ES6基础入门
  • 2023年超越期待的高性能视频剪辑主机推荐| Intel 蝰蛇峡谷测评
  • 1400*A. Factory
  • OpenHarmony开源鸿蒙学习入门 - 基于3.2Release 应用开发环境安装
  • Linux 查看服务器内存、CPU、网络等占用情况的命令
  • 调用webservice导excel文件内容进入数据库
  • *CTF 2023 web jwt2struts 题解wp
  • 使用java实时获取手环、手表的健康数据
  • Maven右侧依赖Dependencies消失
  • 100% RNN language model ChatRWKV 相关开源项目
  • ElasticSearch Window Linux部署
  • MyBatis-Plus 分页插件实现分页查询
  • Nacos源码 (1) 源码编译及idea环境
  • docker配置文件挂载(容器数据管理)
  • uniAPP 视频图片预览组件
  • 【论文阅读】The Deep Learning Compiler: A Comprehensive Survey
  • 怎么维护自己的电脑?
  • day52|● 300.最长递增子序列 ● 674. 最长连续递增序列 ● 718. 最长重复子数组
  • uniapp,vue3路由传递接收参数
  • SkyEye与Jenkins的DevOps持续集成解决方案
  • HCIE Security——防火墙互联技术
  • Rust- 闭包
  • 【数据挖掘torch】 基于LSTM电力系统负荷预测分析(Python代码实现)
  • 「JVM」性能调优工具
  • IDEA Debug小技巧 添加减少所查看变量、查看不同线程
  • 基于SpringBoot+Vue的车辆充电桩管理系统设计与实现(源码+LW+部署文档等)
  • Bean的加载方式