| | |
| | | <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick"> |
| | | <span slot-scope="{ node, data }" class="el-tree-node__label"> |
| | | <span> |
| | | <i class="el-icon-s-promotion"></i> |
| | | <icon-show :name="data.icon"></icon-show> |
| | | {{ (node || {}).label }} |
| | | </span> |
| | | </span> |
| | |
| | | const data = res.data.data.map(item => { |
| | | this.processChildren(item); // 处理每个节点 |
| | | item.attributes.label = item.attributes.id; |
| | | item.attributes.icon = item.attributes.imageName; |
| | | return item.attributes; |
| | | }); |
| | | this.treeData = data; |
| | |
| | | if (item.children && item.children.length > 0) { |
| | | item.attributes.children = item.children.map(child => { |
| | | child.attributes.label = child.attributes.id; |
| | | child.attributes.icon = child.attributes.imageName; |
| | | this.processChildren(child); // 递归处理每个子节点 |
| | | return child.attributes; // 只返回子节点的 attributes |
| | | }); |