vue中引入iconfont
-
打开 iconFont官网 选择自己喜欢的图标,并且添加购物车
-
将选好的图标下载到本地,并复制到assets目录下
-
在main.js中引入文件中的iconfont.css文件
import './assets/iconfont/iconfont.css'
- 然后就可以用啦
<p id="pp"><i class="iconfont icon-tongzhigonggao"></i>666</p>
注意:如果没有下载css-loader依赖包,可能会报如下错误,需要下载一下npm install css-loader --save
These relative modules were not found:
* ./iconfont.eot?t=1554271744964 in ./node_modules/css-loader??ref--6-1!./node_modules/postcss-loader/lib??ref--6-2!./src/assets/iconfont/iconfont.css
* ./iconfont.svg?t=1554271744964 in ./node_modules/css-loader??ref--6-1!./node_modules/postcss-loader/lib??ref--6-2!./src/assets/iconfont/iconfont.css
* ./iconfont.ttf?t=1554271744964 in ./node_modules/css-loader??ref--6-1!./node_modules/postcss-loader/lib??ref--6-2!./src/assets/iconfont/iconfont.css
* ./iconfont.woff?t=1554271744964 in ./node_modules/css-loader??ref--6-1!./node_modules/postcss-loader/lib??ref--6-2!./src/assets/iconfont/iconfont.css
网友评论