2018-05-05(在小程序中使用图标)

Posted 素~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2018-05-05(在小程序中使用图标)相关的知识,希望对你有一定的参考价值。

项目中常常需要使用到字体图标,微信小程序中使用字体图标与在平常的web前端中类似但是又有区别。下面以使用阿里图标为例子讲解如何在微信小程序中使用字体图标。

第一步:下载需要的字体图标

进入阿里图标官网http://iconfont.cn/搜索自己想要的图标,如这里需要一个购物车的图标,流程为:

搜索“购物车”图标--->点击“添加入库”-->点击购物车进入购物车-->点击下载代码按钮。

技术分享图片

点击下载代码,将得到名为download.zip的压缩包,解压将看到以下内容:

技术分享图片

第二步:转换ttf文件

进入https://transfonter.org/平台,将解压出来的ttf字体文件转化成base64格式。流程如下:

技术分享图片

技术分享图片

点击下载,得到转换后的压缩包,名为transfonter.org-开头。解压可以得到如下图的几个文件:

技术分享图片

第三步:在微信小程序中使用

新建微信小程序,将默认生成的代码删除。

1--在index.css文件中添加样式内容。打开刚刚我们经过转换的解压出来的文件,找到stylesheet.css,将其中的内容全部复制到index.css文件中。注意是转换过的那个文件。

技术分享图片

2--打开没有转换过的download.zip解压出来的文件,找到iconfont.css文件,将这个文件中的没有打岔的内容复制到index.css文件中。@font-face这部分不要,只要下边的这部分。

技术分享图片

 

3--在index.wxml中使用字体图标。代码如下:

 

[html] view plain copy
 
  1. <!--index.wxml-->  
  2. <view class="container">  
  3. 个人中心  
  4. <text class="iconfont icon-wode" style="font-size:50px;color:red"></text>  
  5. </view>  

效果如下:

技术分享图片

 

 

字体图标跟字体一样,可以通过font-size来改变大小,通过指定color来改变他的颜色。

 

总结:到这里微信小程序的字体图标的使用就完成了,这里经过转换成64位编码之后,直接将样式放在css文件中即可,并不需要引入其他以外的文件,相当简洁。

 

 

附上css全部代码:

 

[css] view plain copy
 
  1. /* This stylesheet generated by Transfonter (https://transfonter.org) on July 3, 2017 11:03 AM */  
  2.   
  3. @font-face {  
  4.     font-family: ‘iconfont‘;  
  5.     src: url(data:font/truetype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yEbsAIlsAIlRyNHI2EgsAUlsAQlRyNHI2GwBiWwBSVJsAIlYbABRWMjIFhiGyFZY7ABRWJgIy4jICA8ijgjIVktsDMssAAWILAJQyAuRyNHI2EgYLAgYGawgGIjICA8ijgtsDQsIyAuRrACJUZSWCA8WS6xJAEUKy2wNSwjIC5GsAIlRlBYIDxZLrEkARQrLbA2LCMgLkawAiVGUlggPFkjIC5GsAIlRlBYIDxZLrEkARQrLbA3LLAuKyMgLkawAiVGUlggPFkusSQBFCstsDgssC8riiAgPLAEI0KKOCMgLkawAiVGUlggPFkusSQBFCuwBEMusCQrLbA5LLAAFrAEJbAEJiAuRyNHI2GwBkUrIyA8IC4jOLEkARQrLbA6LLEJBCVCsAAWsAQlsAQlIC5HI0cjYSCwBCNCsAZFKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgR7AEQ7CAYmAgsAArIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbCAYmGwAiVGYTgjIDwjOBshICBGI0ewACsjYTghWbEkARQrLbA7LLAuKy6xJAEUKy2wPCywLyshIyAgPLAEI0IjOLEkARQrsARDLrAkKy2wPSywABUgR7AAI0KyAAEBFRQTLrAqKi2wPiywABUgR7AAI0KyAAEBFRQTLrAqKi2wPyyxAAEUE7ArKi2wQCywLSotsEEssAAWRSMgLiBGiiNhOLEkARQrLbBCLLAJI0KwQSstsEMssgAAOistsEQssgABOistsEUssgEAOistsEYssgEBOistsEcssgAAOystsEgssgABOystsEkssgEAOystsEossgEBOystsEsssgAANystsEwssgABNystsE0ssgEANystsE4ssgEBNystsE8ssgAAOSstsFAssgABOSstsFEssgEAOSstsFIssgEBOSstsFMssgAAPCstsFQssgABPCstsFUssgEAPCstsFYssgEBPCstsFcssgAAOCstsFgssgABOCstsFkssgEAOCstsFossgEBOCstsFsssDArLrEkARQrLbBcLLAwK7A0Ky2wXSywMCuwNSstsF4ssAAWsDArsDYrLbBfLLAxKy6xJAEUKy2wYCywMSuwNCstsGEssDErsDU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AAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAEAAgBbAQIBAwEEAQUBBgEHAQgBCQEKAQsKeW91amlhbnRvdQR3b2RlBnNlYXJjaBBkaWxpd2Vpemhpc2hlemhpCmRhaXBpbmdqaWEKZGFpc2hvdWh1bwRpY29uCGRhaWZhaHVvCWRhaWZ1a3VhbgZzaG91eWUAAAEAAf//AA8AAQAAAAwAAAAWAAAAAgABAAEADQABAAQAAAACAAAAAAAAAAEAAAAA1CSZJgAAAADVf9FKAAAAANV/0Uo=) format(‘truetype‘);  
  6.     font-weight: 500;  
  7.     font-style: normal;  
  8. }  
  9.   
  10. .iconfont {  
  11.   font-family:"iconfont" !important;  
  12.   font-size:16px;  
  13.   font-style:normal;  
  14.   -webkit-font-smoothing: antialiased;  
  15.   -moz-osx-font-smoothing: grayscale;  
  16. }  
  17.   
  18. .icon-search:before { content: "\e611"; }  
  19.   
  20. .icon-youjiantou:before { content: "\e603"; }  
  21.   
  22. .icon-daifukuan:before { content: "\e684"; }  
  23.   
  24. .icon-daishouhuo:before { content: "\e642"; }  
  25.   
  26. .icon-wode:before { content: "\e606"; }  
  27.   
  28. .icon-icon:before { content: "\e64b"; }  
  29.   
  30. .icon-diliweizhishezhi:before { content: "\e616"; }  
  31.   
  32. .icon-daifahuo:before { content: "\e678"; }  
  33.   
  34. .icon-daipingjia:before { content: "\e619"; }  
  35.   
  36. .icon-shouye:before { content: "\e69d"; }  

以上是关于2018-05-05(在小程序中使用图标)的主要内容,如果未能解决你的问题,请参考以下文章

如何在小程序导航栏放一个搜索框?

微信小程序——自定义图标组件

微信小程序组件解读和分析:icon图标

在微信小程序中引入 Iconfont 阿里巴巴图标库

微信小程序引入iconfont字体图标(阿里巴巴矢量图标库)

在小部件中单击 textview 时更改图标