vue-elementui树组件添加连接线
2022/4/23 6:14:11
本文主要是介绍vue-elementui树组件添加连接线,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
<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> -->
这篇关于vue-elementui树组件添加连接线的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-15基于JSON的大型语言模型代理与Ollama及LangChain的应用
- 2024-11-15useCallback教程:React Hook入门与实践
- 2024-11-15React中使用useContext开发:初学者指南
- 2024-11-15拖拽排序js案例详解:新手入门教程
- 2024-11-15React中的自定义Hooks案例详解
- 2024-11-14受控组件项目实战:从零开始打造你的第一个React项目
- 2024-11-14React中useEffect开发入门教程
- 2024-11-14React中的useMemo教程:从入门到实践
- 2024-11-14useReducer开发入门教程:轻松掌握React中的useReducer
- 2024-11-14useRef开发入门教程:轻松掌握React中的useRef用法