1、在main.ts 中配置
import * as Icons from "@element-plus/icons-vue"; // 注册全局组件 Object.keys(Icons).forEach((key) => {app.component(key, Icons[key as keyof typeof Icons]);});
2、vue 中使用
<el-icon><component :is="k.icon"></component></el-icon> // 其中k.icon 就是icon 的名称 如:Menu Loading 等等