//第一步// 下载icon库
npm install @element-plus/icons-vue
//注册组件//
1.逐个注册
//main.js
import {Edit,Delete} from '@element-plus/icons-vue'
const app = createApp(app)
app.component('edit', Edit)
app.componet('delete',Delete)
app.mount('#app')
2.全局注册
//main.js
import * as ELIcons from '@element-plus/icons-vue'
const app = createApp(app)
for(let iconName in ELIcons){
app.component(iconName,ELIcons[iconName])
}
app.mount('#app')
vue3版本以后
element-plus icon 数组渲染菜单
<el-icon>
<component :is="item.icon"/>
</el-icon>
:<component :is="图标名称"/>