<el-input>中的prefix-icon图标不显示问题

问题:

自己在引入icon时,安装官网的方式进行添加组件,在 el-inputprefix-icon 添加icon后,明显看出有空间用于显示 icon,但却不显示图标。
image

报错原因

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)
    .use(ElementPlus)// ui 框架
    .use(Router)// 路由
    .use(i18n)// 国际化
    .mount('#app')

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

main.js 文件中,因为是后加的代码。component方法,写在了后面。此时createApp,已经挂到了app.vue中。以至于后面的组件注入,无法被使用。

posted @ 2023-02-12 11:47  之士咖啡  阅读(485)  评论(0编辑  收藏  举报