首页 > 其他分享 >Elementui-Plus动态渲染图标icon

Elementui-Plus动态渲染图标icon

时间:2024-08-20 23:22:41浏览次数:9  
标签:Elementui 样式 component ElementPlusIconsVue 14px Plus 图标 icon

一、在main.ts引入相关依赖:

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

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

二、使用 component 组件进行动态加载

<component class="icons" :is="icon"></component>

其中 icon变量的的值可以是 DataAnalysis、User等,可在页面进行复制:图标地址

三、  修改样式

在vue页面增加样式:

svg {
  width: 14px;
  height: 14px;
  margin-right: 5px;
  padding-top: -1px;
}

处理后,即可通过icon值进行动态渲染图标,图标大小可以通过svg样式进行控制!

标签:Elementui,样式,component,ElementPlusIconsVue,14px,Plus,图标,icon
From: https://blog.csdn.net/qq_35204012/article/details/141365022

相关文章

  • [20240818]测试21c下sqlplus show recyclebin的小问题2.txt
    [20240818]测试21c下sqlplusshowrecyclebin的小问题2.txt--//以前测试过,链接[20210722]sqlplus下showrecycebin的小问题.txt--//注:recycebin拼写错误应该是recyclebin.--//这个问题当时也是浪费了大量实际,我记忆遇到问题时是上午,执行showrecyclebin;[注空格+;],linux......
  • Element Plus 应用和router应用
    1.ElementPlus折叠按钮的应用el-menu组件为最初框架el-menu-item子框架按钮键el-sub-menu折叠按钮.el-menu--horizontal>.el-menu-item:nth-child(7){margin-right:auto;}位置样式constactiveIndex=ref('1')使用索引main.js中引用全局ElementPlus引用包......
  • MapStruct-plus cannot find converter from
     废话不多,直接上1错误:cannotfindconverterfrom 2描述我的情况我的项目分为2块,一块是接口,一块是实现API接口(kintech-api-bo):其中dto,req,res包含了@AutoMapper 实现(kintech-bo): 3问题当我的其他模块(kintech-crm),引用了kintech-api-bo时,调用如下语句就会报错......
  • elementUI Steps 步骤条样式修改
    1.修改前的效果2.修改后的效果2.实现代码<template><el-steps:active="active"align-center><templatev-for="iteminarrData"><el-step:key="item.id":title="item.name":class=&......
  • Mybatis-Plus中的@TableName 和 table-prefix
    简介本文介绍Mybatis-Plus中的@TableName和table-prefix的使用。介绍在MyBatis-Plus中,@TableName注解和table-prefix配置都可以用来指定表名,但它们的作用方式略有不同。table-prefix配置table-prefix是一个全局配置,它会自动在所有表名前添加指定的前缀,这个配置对于......
  • 关于c++使用toml plusplus(俗称toml++)的使用(4)
    链接toml++-githubtoml++-帮助文档使用要求:c++17及以上版本toml语法-英文toml语法-中文toml读取参见官方给出的范例toml写入目标:表嵌套子表数组的写入比如:文件内容[NET_INTERFACE]bool=falsebool_arr=[false,false]complex_arr......
  • 关于c++使用toml plusplus(俗称toml++)的使用(3)
    链接toml++-githubtoml++-帮助文档使用要求:c++17及以上版本toml语法-英文toml语法-中文toml读取参见官方给出的范例toml写入目标:数组的写入文件内容[NET_INTERFACE]bool=falsebool_arr=[false,false]complex_arr=[false,'456'......
  • 关于c++使用toml plusplus(俗称toml++)的使用(2)
    链接toml++-githubtoml++-帮助文档使用要求:c++17及以上版本toml语法-英文toml语法-中文toml读取参见官方给出的范例toml写入目标目标:数组表的写入目标文件内容如下[NET_INTERFACE]bool=falseinteger=1234567890string='thisisastring'[[f......
  • 关于c++使用toml plusplus(俗称toml++)的使用
    链接toml++-githubtoml++-帮助文档使用要求:c++17及以上版本toml语法-英文toml语法-中文toml读取参见官方给出的范例toml写入一个范例,一个开胃菜toml文件待生成的目标文件内容为[NET_INTERFACE]bool=falseinteger=1234567890string='thisis......
  • 以c primer plus(第六版)为大纲的C语言初学手记,含示例代码及编程练习(第四章)
    //第4章//example4.1//#include<stdio.h>//#include<string.h> //toincludestrlrn()//#defineDENSITY62.4 //todefineaconstant//intmain()//{//   floatweight,volume;//   intsize,letters;//   charname[40]; //todeclareadig......