iconfont字体矢量图标的使用方法

打开阿里巴巴矢量图标库 https://www.iconfont.cn/

点击登录

在这里插入图片描述

使用github账号登录,其他账号也可以

在这里插入图片描述

找一组图标点击进去,添加入库

在这里插入图片描述

点击购物车图标

在这里插入图片描述

点击添加进项目,没有项目可以创建

在这里插入图片描述
在这里插入图片描述

这里选择的是Unicode引用,点击下载至本地

在这里插入图片描述

把下载好的文件解压出来,放到项目的css和fonts文件夹

在这里插入图片描述

注意iconfont.css里的文件路径

@font-face {font-family: "iconfont";
  src: url('./../fonts/iconfont.eot?t=1551842195237'); /* IE9 */
  src: url('./../fonts/iconfont.eot?t=1551842195237#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAdUAAsAAAAADaAAAA') format('woff2'),
  url('./../fonts/iconfont.woff?t=1552034083716') format('woff'),
  url('./../fonts/iconfont.ttf?t=1551842195237') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
  url('./../fonts/iconfont.svg?t=1551842195237#iconfont') format('svg'); /* iOS 4.1- */
}

.iconfont {
  font-family: "iconfont" !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-search:before {
  content: "\e625";
}

.icon-star1:before {
  content: "\e681";
}

.icon-warn:before {
  content: "\e6c8";
}

在main.js文件里引用全局css

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './vuex'

import './assets/css/iconfont.css'

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  components: { App },
  template: '<App/>'
})

在组件里使用字体图标
在这里插入图片描述
在这里插入图片描述

 <span class="iconfont">&#xe603;</span>
  • 15
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

半度℃温热

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值