赞
踩
需求:项目做类型文件j夹列表树,设计需要将三角图标替换成UI设计的icon,UI设计的icon放在了阿里图标库
// main.js中先引入iconfont的css和js
import '@/assets/iconfont/iconfont.css'
import '@/assets/iconfont/iconfont.js'
<el-tree :data="getPerSrcTree" default-expand-all :expand-on-click-node="false" node-key="id" ref="atree" highlight-current :check-strictly="true" :props="defaultProps" @node-click="nodeClick" > <span class="custom-tree-node" slot-scope="{ node }"> <span style="display: flex;align-items: center;"> <i calss="iconfont icon-wendangdakai" width="20px" height="20px"></i>{ { node.label }} </span> </span> </el-tree>
这种方式出来的icon就会没有颜色,就要在css内设置需要的颜色,如果用svg的话直接就可以将原有颜色显示出来
<el-tree
:data="getPerSrcTree"
default-expand-all
:expand-on-click-node="false"
node-key="id"
ref="atree"
highlight-current
:check-strictly="true"
:props="defaultProps"
@node-click="nodeClick"
>
<span class="custom-tree-node" slot-scope="{ node }">
<span style="display: flex;align-items: center;">
<iconSvg name
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。