微信小程序|开发FAQ篇

微信小程序|开发FAQ篇

  • 开发过程中FAQ:
    • Q1:看不明白如何使用iconfont图标的,不清楚代码的的使用。
    • Q2:svg、eot、ttf、woff比较?
    • Q3:如何使用阿里图标库(iconfont)实现一个自定义组件,封装属性并使用?

开发过程中FAQ:

Q1:看不明白如何使用iconfont图标的,不清楚代码的的使用。

在学习开源组件Lin UI的card组件时,发现其中的自定义组件icon在使用图标是使用的阿里巴巴iconfont图标库。

.l-icon {
  font-family            : "l-iconfont";
  font-size              : 40rpx;
  color                  : @theme-color;
  font-style             : normal;
  -webkit-font-smoothing : antialiased;
  -moz-osx-font-smoothing: grayscale;
}
// 代码太长大致逻辑如下
@font-face {font-family: "iconfont";
  url('data:application/x-font-woff2;charset=utf-8;base64,d09GRgABAAAAAAUkAAsAAAAAB4AAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZW70ftY21hcAAAAYAAAABcAAABhplABr5nbHlmAAAB3AAAAVgAAAFsZoj2dmhlYWQAAAM0AAAALwAAADYSH23BaGhlYQAAA2QAAAAgAAAAJAfgA4NobXR4AAADhAAAAAwAAAAMC+kAAGxvY2EAAAOQAAAACAAAAAgAdgC2bWF4cAAAA5gAAAAfAAAAIAESAF1uYW1lAAADuAAAAUUAAAJtPlT+fXBvc3QAAAUAAAAAIgAAADPge++EeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/sE4gYGVgYOpk+kMAwNDP4RmfM1gxMjBwMDEwMrMgBUEpLmmMDgwVDxjYm7438AQw9zI0AgUZgTJAQAjlgxweJzFkMENgDAMAy9p6QMxCA8G4sUcnbhrFBPKgwlqybHiWEoUYAGSeIgZ7MJ4cMq18BNr+DkyRWo4tXnv6j9VRLMS6iqFabB5q//You6j01eogzqx+Uv8BlHvC5d4nA2PrU7DUABG73dLu3Zs7e7tf7d1a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MpWBAQASpALPAAA=') format('woff2')
}

.l-icon-error:before {
  content: "\e605";
}

.l-icon-duihao:before {
  content: "\e63c";
}...

A1: 图标可以单个使用、Unicode使用、font-class引用和symbol引用方式。

具体操作参展官方:https://www.iconfont.cn/help/detail?spm=a313x.7781069.1998910419.17&helptype=code

代码解释:本文使用font-class方式引入。font-family使用得就是iconfont图标库,采用的是woff2字体格式,url要用base64编码导入。找出图标的 Unicode编码应该是"\e605",然后打上自定义标签"l-icon-error",之后就可以使用图标。

Q2:svg、eot、ttf、woff比较?

  • “iconfont.svg”是图标库的svg格式文件;
  • “iconfont.eot”,“iconfont.ttf”,“iconfont.woff”的图标库的字体格式文件;

注意,这里的SVG指的是svg字体

A2:介绍

SVG / SVGZ
SVG(Scalable Vector Graphics),即矢量图,是用于描述二维矢量图形的一种图形格式。在 Web 中使用 SVG 可以解决位图放大失真的问题。

TTF / OTF
TTF(TrueTypeFont)是Apple公司和Microsoft公司共同推出的字体文件格式,随着windows的流行,已经变成最常用的一种字体文件表示方式。部分的因为这种格式容易被非法复制,因此催生了后来的WOFF字体格式。

EOT
EOT(Embedded Open Type),是微软创造的字体格式。这种格式只在IE6-IE8里使用。

WOFF
WOFF(Web Open Font Format)是一种网页所采用的字体格式标准。此字体格式发展于2009年,现在正由万维网联盟的Web字体工作小组标准化,以求成为推荐标准。此字体格式不但能够有效利用压缩来减少档案大小,并且不包含加密也不受DRM(数位著作权管理)限制。WOFF字体通常比其它字体加载要快,因为使用了OTF和TTF字体里的存储结构和压缩算法。这种字体格式还可以加入元信息和授权信息。

WOFF2(*)
WOFF2(Web Open Font Format 2.0),相比woff最大的优化应该是加强了字体的压缩比。

上述图标(字体)格式大小
iconfont size

woff2(*) < woff < ttf ≈ eot < svg

从请求量上来看,woff\woff2格式的图标库最小

参考:https://blog.csdn.net/qq_24357165/article/details/81292448

Q3:如何使用阿里图标库(iconfont)实现一个自定义组件,封装属性并使用?

A3:
一、先去阿里矢量图官网寻找意向图标(这里使用在线链接)。
1、登录阿里图标库官网https://www.iconfont.cn/,新建一个项目,例如我新建的项目是icon。
2、把需要的图标加入购物车,然后再添加到项目里。
微信小程序|开发FAQ篇_第1张图片
微信小程序|开发FAQ篇_第2张图片
打开在线链接如图所示,
微信小程序|开发FAQ篇_第3张图片

二、创建icon组件
先创建icon文件夹,然后新建component,组件名为index(当然你也可以自定义)这样就会出现四个文件index.js、index.json、index.wxml、index.wxss
此时index.json文件中componet的值已经为true,表示此文件为自定义组件。
微信小程序|开发FAQ篇_第4张图片
微信小程序|开发FAQ篇_第5张图片
3、编写icon组件内容

index.wxml

<view class="l-class l-icon {{ name === '' ? '' : 'l-icon-' + name }}" 
style="{{ size ? 'font-size:'+size+'rpx;':''}}{{ color ? 'color:' + color+';' : '' }}"/>

index.js

Component({
	externalClasses:['l-class'], // 通过外部样式在testPage.wxml中对组件属性进行选择
	options: { // options键 用来设置组件隔离性,addGlobalClass表示页面 wxss 样式将影响到自定义组件,但自定义组件 wxss 中指定的样式不会影响页面。所有属性参考:https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html
		addGlobalClass: true
	},
	properties: { // icon组件中定义的几个属性和它们的默认值
		name: String,
		color: {
			type: String,
			value: '#3963bc'
		},
		size: {
			type: String,
			value: '40'
		},
	},
	ready: function (){
		if(!this.properties.name) {
			console.error('请传入Icon组件的name属性');
		}
	},
	method: {
	}
});

微信小程序|开发FAQ篇_第6张图片

index.wxss
直接复制iconfont网址的font-class的在线链接css的内容(添加一些图标默认color、字体大小等设置):

!!!2021/1/22----PS新增使用说明:
这里的font-family可以使用自己的图标库 l-iconfont。当然url是自己的资源地址。这里的l-icon表示自己设置的图标大小、颜色。后续使用图标只需在name属性中填充l-icon-后面的名称即可。

.l-icon{display:flex;
  font-family:l-iconfont;font-size:40rpx;color:#3963bc;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@font-face{font-family:l-iconfont;src:url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgAB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T3Y8/gKd2XNh8KUherVoFAXBYH9tFwcFVEALzQE/gaAjdqGOG+fNhJe3F/iS6To6WC4u3qxVxA5ADsehBR4O3RIYanNFcQXZBeAa+TbPFvun6C2PJBcPOldJCv0QO90n1cA271It4Ig3OIYjrj8VZlUfpA0f4cZUly6H4RsDzdO50sca1t6Lb4UvW68ObjYL0ihbmW/wna3BABcaVMHDob4vyDSnwZb7v22iTofZWEuqM3wystEcyJDcG9ciZfk/ei44UgOzd1AHfw7TjnVtn0PgpDdl554D9n8PwHXAz98Jbn7Q6jj/6b714FzP/7dp2TicMSbP/aOBX/3p3FwSax3bjsisbWzFPkIJ3N5fF8E6f5nP77y+IgrsLMun2WgUXNgy9W5CW18jj6ITo77aI5PAfOzaF70mZr0zKhZY04pm9fUSmdPrTX21daq/cGdCQdARBnAitNTw6hbTYZ9q9moRymbX7Uy7Vdro4GorQvIPGJnIXak16/AKYK93C15LpGH9fXa9xfmnp08dyR7/0EanbPHrZz3y58oEBx3aOt8Uo02Ci/27C0NObOtwl/wukuq9WO/LSpvDTvPy8PrV+AUwV7u5zeT5xK/WF9T//wvzD07KZly8+Z/kEY/3R53BwDlUxagKdsyuK3zSQMr2uNo4cWeAws5LrGt+dW+4HWXINz6sQ+uFkHlrv74onJS+KaN/lPgtwENaURjmtCUZsSIozmBeBJIJElWVE03TMt2XM8PwihO0iwvyqpu2q5fLFeCratIEZZN6JQcDysFsIks19GFIGhtujh/vTkJz281Ge9EB5+5YfQJ/oowcrNVC4qawLfyU9qb8gLZpkFW8tgEZCgMAulU6mZ2YRKCQKqN2hDdyjKS4sgDTUKuz7hjTIRh3XI3GVFNpiveCytF8k6Jy8ASICOWwVTmqbrWbu/1mIUFYyWvXfBSe85bYuWD0Jx0wp0bnPg01MQFY4Pqh4NN864MLbmF07r3tEYwjXswSguelepGecvA+tSr+U9nMr3VCg2V5cOiOnkA') format('woff2')}.l-icon-error:before{content:"\e605"}.l-icon-duihao:before{content:"\e63c"}.l-icon-video:before{content:"\e609"}.l-icon-fork:before{content:"\e632"}.l-icon-address:before{content:"\e606"}.l-icon-backward:before{content:"\e607"}.l-icon-add:before{content:"\e608"}.l-icon-cart:before{content:"\e60a"}.l-icon-close:before{content:"\e60b"}.l-icon-checked:before{content:"\e60c"}.l-icon-comment:before{content:"\e60d"}.l-icon-down:before{content:"\e60e"}.l-icon-customer-service:before{content:"\e60f"}.l-icon-delete:before{content:"\e610"}.l-icon-edit:before{content:"\e611"}.l-icon-download:before{content:"\e612"}.l-icon-ellipsis:before{content:"\e613"}.l-icon-favor:before{content:"\e614"}.l-icon-favor-fill:before{content:"\e631"}.l-icon-forward:before{content:"\e615"}.l-icon-help:before{content:"\e616"}.l-icon-eye:before{content:"\e617"}.l-icon-history:before{content:"\e618"}.l-icon-left:before{content:"\e619"}.l-icon-like:before{content:"\e61a"}.l-icon-notification:before{content:"\e61b"}.l-icon-order:before{content:"\e61c"}.l-icon-loading:before{content:"\e61d"}.l-icon-password:before{content:"\e61e"}.l-icon-more:before{content:"\e61f"}.l-icon-picture:before{content:"\e620"}.l-icon-pull-down:before{content:"\e621"}.l-icon-right:before{content:"\e622"}.l-icon-research:before{content:"\e623"}.l-icon-phone:before{content:"\e624"}.l-icon-setting:before{content:"\e625"}.l-icon-scan:before{content:"\e626"}.l-icon-share:before{content:"\e627"}.l-icon-success:before{content:"\e628"}.l-icon-soud:before{content:"\e629"}.l-icon-time:before{content:"\e62a"}.l-icon-warning:before{content:"\e62b"}.l-icon-to-top:before{content:"\e62c"}.l-icon-up:before{content:"\e62d"}.l-icon-WiFi:before{content:"\e62e"}.l-icon-user:before{content:"\e62f"}

4、使用自定义icon组件

//在需要放置的wxml上(testPage.wxml)
<l-icon name="comment" color="#666" size="28" />

//还需在使用icon的页面json文件中配置(testPage.json)
"l-icon":"/components/icon/index"

参考:
(1)https://blog.csdn.net/qq15577969/article/details/102934589
(2)https://www.cnblogs.com/ailiuzhe/p/11910548.html

你可能感兴趣的:(微信小程序学习,小程序)