element-plus icon显示不出来时的一种解决方法
LogByMax
2022年09月18日 15:05

(认知有限,如有不妥,还望告知,欢迎讨论。)

step1. 安装element-plus/icons

代码块
Shell
自动换行
复制代码
npm install @element-plus/icons
复制成功

step2.在main.js或main.ts中注册所有的icon

代码块
ts
自动换行
复制代码
import * as Icons from '@element-plus/icons-vue'

const app = createApp(App)

Object.keys(Icons).forEach((key) => {

    app.component(key, Icons[key]);

}); 
复制成功

step3.然后就可以按照官网上的示例使用了。

=END=============================

=reference=

[1] https://element-plus.org/zh-CN/component/icon.html