vite vue3 Element-plus icon图标不能使用的问题
//main.js
import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import locale from 'element-plus/lib/locale/lang/zh-cn' //分页组件显示中文
import 'element-plus/dist/index.css'
import router from './router'
import './style/index.css'
//icon图标的注册与使用,
import * as Icons from '@element-plus/icons-vue' //统一导入
const app = createApp(App)
//全局注册
for(let iName in Icons){
app.component(iName,Icons[iName])
console.log(iName)
}
app.use(ElementPlus, { locale })
app.use(router)
app.mount('#app')
在组件中使用时
以下方式可以全局使用
<el-button type="primary" > <search style="width: 1em; height: 1em; margin-right: 8px;" /> 测试图标</el-button>
<el-icon><edit/></el-icon>
但在
<component class="xxx" :is="Edit"></component>
不能使用,
我想动态通过变量或函数改变图标,请问应该怎么用
你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答
本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。
因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。