小程序——button

button

<button 

      open-type="getUserInfo"   

      bindgetuserinfo="onGetUserInfo" 

      class="userinfo-avatar"  

      style="background-image: url({{avatarUrl}})"

      size="default" 

></button>

按钮(有点类似于navigator)

属性 类型 默认值 必填 说明
size string default 按钮的大小
type string default 按钮的样式类型
plain boolean false

按钮是否镂空,背景色透明,更加美观

非镂空: 

镂空:     

disabled boolean false 是否禁用禁用后文字将变成灰色
loading boolean false 名称前是否带 loading 图标
form-type string   用于 form 组件,点击分别会触发 form 组件的 submit/reset 事件???
open-type string   微信开放能力
hover-class string button-hover 指定按钮按下去的样式类。当 hover-class="none" 时,没有点击态效果
hover-stop-propagation boolean false 指定是否阻止本节点的祖先节点出现点击态
hover-start-time number 20 按住后多久出现点击态,单位毫秒
hover-stay-time number 70 手指松开后点击态保留时间,单位毫秒
lang string en 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。
session-from string   open-type="contact"时有效,会话来源,
send-message-title string 当前标题 open-type="contact"时有效,会话内消息卡片标题,open-type="contact"时有效
send-message-path string 当前分享路径 open-type="contact"时有效,会话内消息卡片点击跳转小程序路径
send-message-img string 截图 open-type="contact"时有效,会话内消息卡片图片
app-parameter string   open-type="contact"时有效,打开 APP 时,向 APP 传递的参数
show-message-card boolean false open-type="contact"时有效,是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息
bindgetuserinfo eventhandle   open-type="contact"时有效,用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与wx.getUserInfo返回的一致
bindcontact eventhandle   open-type="contact"时有效,客服消息回调,open-type="contact"时有效
bindgetphonenumber eventhandle   open-type="contact"时有效,获取用户手机号回调
binderror eventhandle   open-type="contact"时有效,当使用开放能力时,发生错误的回调
bindopensetting eventhandle   在打开授权设置页后回调,open-type=openSetting??时有效
bindlaunchapp eventhandle   打开 APP 成功的回调,open-type=launchApp时有效

size 的合法值

说明
default 默认大小
mini 小尺寸

type 的合法值

说明
primary 绿色
default 白色
warn 红色

form-type 的合法值

说明
submit 提交表单
reset 重置表单

open-type 的合法值

说明 最低版本
contact 打开客服会话?,如果用户在会话中点击消息卡片后返回小程序,可以从 bindcontact 回调中获得具体信息,具体说明 1.1.0
share 触发用户转发,使用前建议先阅读使用指引 1.2.0
getPhoneNumber 获取用户手机号,可以从bindgetphonenumber回调中获取到用户信息,具体说明 1.2.0
getUserInfo 获取用户信息(昵称,头像,ID),可以从bindgetuserinfo回调中获取到用户信息 1.3.0
launchApp 打开APP,可以通过app-parameter属性设定向APP传的参数具体说明 1.9.5
openSetting 打开授权设置 2.0.7
feedback 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容 2.1.0

lang 的合法值

说明
en 英文
zh_CN 简体中文
zh_TW 繁体中文
发布了19 篇原创文章 · 获赞 0 · 访问量 789

猜你喜欢

转载自blog.csdn.net/weixin_44151772/article/details/104615813