在vue3中使用Element-plus的图标

首先安装Element-Plus-icon

# 选择一个你喜欢的包管理器

# NPM
$ npm install @element-plus/icons-vue
# Yarn
$ yarn add @element-plus/icons-vue
# pnpm
$ pnpm install @element-plus/icons-vue

如何使用

Element-Plus-icon官方文档链接Icon 图标 | Element Plus (element-plus.org)icon-default.png?t=N7T8https://element-plus.org/zh-CN/component/icon.html#icon-collection

在main.ts中引入Element-Plus-icon

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

Object.keys(ElementPlusIconsVue).forEach((key) => {
    app.component(key, ElementPlusIconsVue[key])
})

第一种直接点击图标复制

                    

第二种通过icon="el-icon-plus" 


    1111

第三种通过SVG

你可能感兴趣的:(vue.js,前端,javascript)