1. Achieve results2. Implementation CodeThe addition of dotted lines to the tree control is mainly achieved by controlling CSS, and the indent number of the tree control can only be 0, so let class="mytree" <div class="mytree"> <!--indent can only be 0--> <el-tree :data="tree_data" :props="defaultProps" @node-click="handleNodeClick" indent="0" :render-content="renderContent" ></el-tree> </div> The css is set to the following code, using <style lang="scss" scoped> ::v-deep .mytree { .el-tree > .el-tree-node:after { border-top: none; } .el-tree-node { position: relative; padding-left: 16px; } //There is a gap between nodes, just hide the expand button, if you think the gap is okay, you can delete it.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 dashed #4386c6; bottom: 0px; height: 100%; top: -26px; width: 1px; } .el-tree-node:after { border-top: 1px dashed #4386c6; height: 20px; top: 12px; width: 24px; } } </style> 3. Other ImplementationsVue implements tree table through element tree control Element-ui implements adding icons to tree control nodes SummarizeThis article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM! You may also be interested in:
|
<<: How to hide a certain text in HTML?
Table of contents 1. Node builds HTTP server 2. H...
Record the installation and configuration method ...
Four practical vue custom instructions 1. v-drag ...
Preface In the early stages of some projects, dev...
Table of contents Overview 1. Global Registration...
Recently, a system was deployed, using nginx as a...
Preface: Front-end: jq+h5 to achieve the nine-gri...
Table of contents 1. Nodes, trees, and virtual DO...
Use scenarios: The project's pages need to lo...
Table of contents Preface Global parameter persis...
This article mainly describes two kinds of underl...
This article shares a sharing sidebar implemented...
Table of contents 1. Global level 2. Database lev...
Preface This article mainly shares with you an ex...
Table of contents Water wave effect Let's see...