1、打开官网:https://www.iconfont.cn/,把整理好的图标下载解压。
2、由于微信小程序不支持直接在wxss中引入.ttf/.woff/.woff2(在开发工具生效,手机不生效)。我们需要对下载的文件进一步处理。
- eot:IE系列专属字体方案,不推荐。
- svg:不是真的字体,存在很多兼容问题,已经被大部分浏览器抛弃,不推荐。
- ttf:兼容性好,但是字体文件较大 ,不推荐。
- woff:W3C标准,兼容性好,推荐。
- woff2:W3C标准,但是不兼容IE,推荐。
3、我们选择转换.woff2文件为base64,转换地址:File To Base64 Encoder | Convert any file | GiftOfSpeed
4、修改iconfont文件
@font-face {
font-family: "iconfont"; /* Project id 4737589 */
src: url("data:font/truetype;charset=utf-8;base64,d09GMgABAAAAABGIAAsAAAAAHmwAABE4AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACEegqtAKJIATYCJANECyQABCAFhGcHgTQbThhFRoWNA0Di0UGy/8sEbgyB19CXaSMYpMEGLb5oEVrN5F8rCHXSiht2DpSTQ66RIFVUWL8/keCikh4Ja+o1/UDb/Hd3xNEnkfa+YCS6AKMxKhAsXFmFus7WVaGf7f9lcDhnLeu9UCdU0c0+efRpdgk3DY2Ef55//3b+7iuQtjyBFkggiX+SIizUOGned2rSxlZhYEhSGpVgkHZAYBgB2H970h3LkLjlhEdcGFMcH3/T130SAziY3Gc/618A/Lj2apMBgCxkhMLOissVc8mHV35lTMY3JLXK2umxUD+/gKC2uck5NkJMTQgxA/GqnfLOQbFQVOPfcwEEAJ23IOiumS8Cdi85vBdIkZCWCLhcjfTKbRsA7qcjKXYi8CDFtM+SIzOADNATvQIA0+Nfj/ygbDgAihwg40rWz9gMTpjQAAUzWlSAvdCV3z1oGwVABoABcK9ZJnKr89YAdhLusaSL/CRNAMBF+ItBP6aJZ/KaDpsaTGNM4wcoFgsoTAwT18Q9riI9iNyN4OITsqX/iQdARsFAx0TgYGNBoDAkVDgaQEaAZNprb9QTwMTgJwAZmJgAFCguPFApHgDoUAJ4YKaESMhDiQDAgRIDgA0lA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