前言:今天说下在项目中的使用图标库
GitHub:https://github.com/Ewall1106/mall
一、新建图标项目
1、打开阿里巴巴矢量图库这个网站,进入图标管理中,在里面新建一个项目

iconfont官网
2、然后我们进入图标库中添加几个图片到购物车中

addCart
3、然后在购物车中将图标添加到项目里面

添加到项目
二、下载图标到本地
进入我的项目中,然后下载到本地;
这里有三种不同的方式下载,区别大家可以到官网里面了解更多;

download
三、项目中引入
1、ok,下载完成了以后,除了iconfont.js
字体文件对我们没有什么用以外,我们把所有的iconfont
复制一下。

iconfont
2、全部复制到styles
目录下

styles
3、然后我们到main.js
中全局引入一下
只要引入iconfont.css
就可以了

main.js
为什么我们这里路径直接以styles
开头的,因为我们在webapck.base.conf.js
中的alias
中配置下路径,这个细节在前面章节有讲,这里再提一下。
四、使用
1、我们在项目中用一下,随便找个页面,随便写个标签,但class
类名要为iconfont

使用
2、span
里面的包裹的十六进制码去网站里面拿

我的项目
3、引入成功没?

浏览器中查看
ok。
参考学习
https://www.jianshu.com/p/03172908d344
http://www.iconfont.cn