ElementUI el-tree 树形控件给节点添加图标
TreeData为后端获取到的数据
<el-tree
:expand-on-click-node="false"
style="180px"
class="tree filter-tree"
:indent="0"
:data="TreeData"
node-key="id"
default-expand-all
:props="defaultProps"
@node-click="handleNodeClick"
>
<span class="custom-tree-node" slot-scope="{ data }">
<span>
<i :class="data.icon" style="font-size:20px color:red"></i
>{{ data.modulename }}
</span>
</span>
</el-tree>