咏竹莉
where there is a will,there is a way
posts - 132,comments - 1,views - 66688

前提工作,先把自己要使用的图标都加入iconfot资源文件中。

1. 选择Symbol的方式,生成链接

 

 

 

 2. 在index.html中引入js

<script src="https://at.alicdn.com/t/font_3298751_bg4cvlhc5ga.js"></script>

 

3. 使用iconfont的地方写:此处的href 名字是在平台定义的iconfont名称

<svg class="icon" aria-hidden="true">
      <use :xlink:href="'#icon-'+item.Icon" />
</svg>

 

4. 修改css及样式

   . 在index.html 先全局设置icon 样式

 

    .icon {
            width: 1em;
            height: 1em;
            vertical-align: -0.15em;
            fill: currentColor;
            overflow: hidden;
        }

 

  . 在使用的vue文件中再个性化设置颜色大小等

  

复制代码
.icon {
  height: 14px;
  width: 14px;
  margin-right: 12px;
}
// 修改图标颜色 .icon:last
-of-type { fill: #5f5f69; } .el-submenu:hover, .el-submenu.is-active, .el-menu-item.is-active, .el-menu-item:hover { span { color: #3585ff; } .icon:last-of-type { fill: #3585ff; } }
复制代码

 

  

 

 

posted on   咏竹莉  阅读(432)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示