微信小程序中的想要引入字体样式的时候是不支持的,那么我们有时候却需要这个功能所以接下来去介绍一下怎么去引入iconfont的图标库。
1.打开iconfont /
2.新建个项目,当然我这里已经新建完了。
3.选择你需要的图标添加到购物车。
4.点击右上角的购物车,把这个图标添加到你的项目中。
5.打开你的项目。
6.点击下载到本地
7.在你小程序的目录下创建iconfont文件夹,并将你下载的文件放到里面,解压
8.打开这个文件夹
@font-face {font-family: "iconfont";src: url('iconfont.eot?t=1540623498736'); /* IE9*/src: url('iconfont.eot?t=1540623498736#iefix') format('embedded-opentype'), /* IE6-IE8 */url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAA1AAAsAAAAAEywAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFY8e0jPY21hcAAAAYAAAACeAAACJjGgOENnbHlmAAACIAAACNAAAAv43l2sG2hlYWQAAArwAAAALwAAADYTE58RaGhlYQAACyAAAAAeAAAAJAfeA5xobXR4AAALQAAAABcAAAAsLBEAAGxvY2EAAAtYAAAAGAAAABgO3hIsbWF4cAAAC3AAAAAfAAAAIAErAVtuYW1lAAALkAAAAUUAAAJtPlT+fXBvc3QAAAzYAAAAZQAAAIHCoBJDeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2BkYWKcwMDKwMHUyXSGgYGhH0IzvmYwYuRgYGBiYGVmwAoC0lxTGByesT67zdzwv4EhhrmBoQEozAiSAwDudQzFeJzlkrERgzAMRb8Bm8SkyKVgilCzB3OkoWGGjJAqi9H/NciXRZMwQuR7vtP3SfZ9GUAEUIu7aIDwRoDFS2ooeo1c9AYP5TdcpVRs2XHgyIkzF67bBjAetZ8Iqu+/lt3a4oQzKiSdZ3XXm0I61P5fXMr+3LNsDjs2KSZH7oE78hHsHDkKDo68BUcHVjc5NmHOTum/OPYjuDqIH+prMzQAAHicjVZrbBTXFb7n3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uWFRq911036ZOmyqJI8et1ANwHo7ACTgC3IA78EgnmzaWx9+8eWNPANzgBx6O3y33kT1cMjtyDRe4F65TfxBukF+Em2jjVbhF/U3YxzOmwm10YXmD17hi9oR3YQ8dfAjXcI1P4Tr1L+EG+Vu4iTv8CrfQ8erCPuZeV7iNRy/2x1YvnF6p5UHFockikzm/gple75KFrdLqnGtbxCZTg6BfSVOdaVvdU+zXQ+ciFVmTqgmrOkmMyq3Z6tAFG+fyUa8XiR6EJuVYY/62xgKOcQWFJQ6MMUIYZIjK6Og7VWb0r7FDwl57Vj3N53RbFNT/c4UBAvTPXFO6stJ5Ok+BPV8bUnV0K27LnpQ0kV7NSRKyQl7WtlRC6gE2ZVeOEXpc0Yk/KGdI/wAJWm7IAAAAeJxtyUsKhDAQRdF6mhg/Da6xJCEpxQqtBsXVt9BTz+QOLlX019O7ARVqGFg0cGjRoceAD9WzsJs4L4XV3nIVNWf2wXnR6FnHS1j3JN8nMeZiU+DtMCmvwayioZmeMQvRD8xEGaUAAAA=') format('woff'),url('iconfont.ttf?t=1540623498736') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/url('iconfont.svg?t=1540623498736#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-bianji:before { content: "\e671"; }
9.在你的微信小程序中新建一个iconfont.wxss的文件夹将代码复制进去。
10.引入你的这个样式
11.添加这个类样式就显示出来了
结语:这样引入样式就结束了,希望能给小伙伴们带来一丝帮助