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-12-26React入门教程:从零开始搭建你的第一个React应用
- 2024-12-25Vue2入门教程:轻松掌握前端开发基础
- 2024-12-25Vue3入门指南:快速搭建你的第一个Vue3项目
- 2024-12-25JS基础知识入门教程
- 2024-12-25React基础知识详解:从入门到初级应用
- 2024-12-25Vue3基础知识详解与实战指南
- 2024-12-25Vue3学习:从入门到初步掌握
- 2024-12-25Vue3入门:新手必读的简单教程
- 2024-12-23【JS逆向百例】爱疯官网登录逆向分析
- 2024-12-21Vue3教程:新手入门到实践应用