直接在浏览器中使用 vue3+element-plus中icons的方法

hykeda2年前Vue2046

首先引入文件,如果用cdn的方式:

<script src="//unpkg.com/@element-plus/icons-vue"></script>

我们也可以直接下载下来,是一个index.iife.min.js文件,引入到文件中。

接下来我们需要在底部挂载的地方将所有的图标挂载进来:

for ([name, comp] of Object.entries(ElementPlusIconsVue)) {
        app.component(name, comp);
    }

这样我们就可以使用element中的icons了:

<el-icon :size="20"><Clock /></el-icon>


标签: vue3iconelement

相关文章

vite+vue 插件/组件集合

自动引入插件:https://github.com/antfu/unplugin-auto-importvue的按需组件自动导入:https://github.com/antfu/unplugin-v...

前端常用的UI组件库

Arco DesignTaro UISemi DesignAnt DesignElementView DesignVantLayui-vueFusion Design1. Arco Desi...

学习lodash

官网:https://www.lodashjs.com/ 链接:https://www.jianshu.com/p/d46abfa4ddc9 简介 L...

vue中的h函数使用

一、参数设置h函数接收三个参数。第一个参数:,可以为一个html标签,一个组件,一个异步组件,或者是一个函数式组件。第二个参数:{ Object } Props,与attributes和props,以...

Vue3 Pinia持久化存储

一、Pinia持久化存储二、使用步骤1.安装插件代码如下(示例):npm i pinia-plugin-persist --save2.store/index.js代码如...

vite.config.js配置@

import { defineConfig } from 'vite'import vue from '@vitejs/plugin-vue'import path f...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。