Vue3中使用Element Plus Icon图标

1. 安装

  npm install element-plus --save

2. main.js 引入

    import * as Elicons from "@element-plus/icons-vue";

    for (const name in Elicons) {
        app.component(name, Elicons[name]);
  }

3. 使用

          <template #title>
            <el-icon><location /></el-icon>
            <span>Navigator One</span>
          </template>

 4. 各类图标

   https://element-plus.org/en-US/component/icon.html#icon-collection

5. vue3 项目中获取不到图标

<strong>We're sorry but world_html doesn't work properly without JavaScript enabled. Please enable it to continue

原因:由于测试的时候,没有使用vue-router进行路由,单文件组件在index.html页面没有使用入口组件,所以才会出现这个问题

 

posted @   半日闲1  阅读(348)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
点击右上角即可分享
微信分享提示