<el-tree :data="data" node-key="id" ref="tree" icon-class="el-icon-share" :props="defaultProps"> <template #default="scope"> <div class="custom-node"> <i class="el-icon-edit"></i> <span>{{scope.node.label}}</span> </div> </template> </el-tree>
通过slot插槽可以自定义节点内容,如果想替换图标,需要自定义图标并把之前的图标隐藏