vue中引入iconfont

vue中引入iconfont

  1. 打开 iconFont官网 选择自己喜欢的图标,并且添加购物车

  2. 将选好的图标下载到本地,并复制到assets目录下

  3. 在main.js中引入文件中的iconfont.css文件

    1
    
    import './assets/iconfont/iconfont.css'
    
  4. 然后就可以用啦

    1
    

    666

注意:如果没有下载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

你可能感兴趣的:(vue)