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 @ 2023-11-01 17:27  半日闲1  阅读(151)  评论(0编辑  收藏  举报