微信小程序学习Course 5 view组件、input组件、button组件

微信小程序学习Course 5 view组件、input组件、button组件

微信小程序学习Course 5 视图组件、input组件、button组件

 

5.1 view组件

 

 

 

 

5.2 input组件

此组件具有以下属性

出处:https://developers.weixin.qq.com/miniprogram/dev/component/input.html

 

属性名类型默认值说明最低版本
valueString 输入框的初始内容 
typeString"text"input 的类型   text文本、number数字、idcard身份证类型、digit带小数的数字键盘 
passwordBooleanfalse是否是密码类型 
placeholderString 输入框为空时占位符;当还没有输入数据时显示的文字 
placeholder-styleString 指定 placeholder 的样式 
placeholder-classString"input-placeholder"指定 placeholder 的样式类 
disabledBooleanfalse是否禁用 
maxlengthNumber140最大输入长度,设置为 -1 的时候不限制最大长度 
cursor-spacingNumber0指定光标与键盘的距离,单位 px 。取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 
auto-focusBooleanfalse(即将废弃,请直接使用 focus )自动聚焦,拉起键盘 
focusBooleanfalse获取焦点 
confirm-typeString"done"设置键盘右下角按钮的文字,仅在type='text'时生效1.1.0
confirm-holdBooleanfalse点击键盘右下角按钮时是否保持键盘不收起1.1.0
cursorNumber 指定focus时的光标位置1.5.0
selection-startNumber-1光标起始位置,自动聚集时有效,需与selection-end搭配使用1.9.0
selection-endNumber-1光标结束位置,自动聚集时有效,需与selection-start搭配使用1.9.0
adjust-positionBooleantrue键盘弹起时,是否自动上推页面1.9.90
bindinputEventHandle 键盘输入时触发,event.detail = {value, cursor, keyCode},value为输入的值;keyCode 为键值,2.1.0 起支持,处理函数可以直接 return 一个字符串,将替换输入框的内容。 
bindfocusEventHandle 输入框聚焦时触发,event.detail = { value, height },height 为键盘高度,在基础库 1.9.90 起支持 
bindblurEventHandle 输入框失去焦点时触发,event.detail = {value: value} 
bindconfirmEventHandle 点击完成按钮时触发,event.detail = {value: value}

重要组件已经用黑色标注

 

5.3 button组件

 bindTap点击事件。

出处:https://developers.weixin.qq.com/miniprogram/dev/component/button.html

属性名类型默认值说明生效时机最低版本
sizeStringdefault按钮的大小  
typeStringdefault按钮的样式类型  
plainBooleanfalse按钮是否镂空,背景色透明  
disabledBooleanfalse是否禁用  
loadingBooleanfalse名称前是否带 loading 图标  
form-typeString 用于 <form/> 组件,点击分别会触发 <form/>组件的 submit/reset 事件  
open-typeString 微信开放能力 1.1.0
hover-classStringbutton-hover指定按钮按下去的样式类。当 hover-class="none" 时,没有点击态效果  
hover-stop-propagationBooleanfalse指定是否阻止本节点的祖先节点出现点击态 1.5.0
hover-start-timeNumber20按住后多久出现点击态,单位毫秒  
hover-stay-timeNumber70手指松开后点击态保留时间,单位毫秒  
langStringen指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。open-type="getUserInfo"1.3.0
bindgetuserinfoHandler 用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与wx.getUserInfo返回的一致open-type="getUserInfo"1.3.0
session-fromString 会话来源open-type="contact"1.4.0
send-message-titleString当前标题会话内消息卡片标题open-type="contact"1.5.0
send-message-pathString当前分享路径会话内消息卡片点击跳转小程序路径open-type="contact"1.5.0
send-message-imgString截图会话内消息卡片图片open-type="contact"1.5.0
show-message-cardBooleanfalse显示会话内消息卡片open-type="contact"1.5.0
bindcontactHandler 客服消息回调open-type="contact"1.5.0
bindgetphonenumberHandler 获取用户手机号回调open-type="getPhoneNumber"1.2.0
app-parameterString 打开 APP 时,向 APP 传递的参数open-type="launchApp"1.9.5
binderrorHandler 当使用开放能力时,发生错误的回调open-type="launchApp"1.9.5
bindopensettingHandler 在打开授权设置页后回调open-type="openSetting"2.0.7
posted @ 2018-09-15 10:49 #Cloud 阅读( ...) 评论( ...) 编辑 收藏
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值