button
<button
open-type="getUserInfo"
bindgetuserinfo = "onGetUserInfo"
class="userinfo-avatar"
style="background-image: url({{avatarUrl}})"
size="default"
></button>
Button (somewhat similar to the navigator)
Attributes | Types of | Defaults | Mandatory | Explanation |
---|---|---|---|---|
size | string | default | no | Size of the button |
type | string | default | no | Button style type |
plain | boolean | false | no | Button is hollow, transparent background color, more beautiful Non-Hollow: Hollow: |
disabled | boolean | false | no | Whether disabled When disabled text will be grayed |
loading | boolean | false | no | With or without loading icon before the name |
form-type | string | no | For form components, respectively click will trigger form the Submit assembly / reset event? ? ? | |
open-type | string | no | WeChat open capacity | |
hover-class | string | button-hover | no | Press down the button to specify the style class. When hover-class="none" , the effect is not clicked state |
hover-stop-propagation | boolean | false | no | Specifies whether to prevent this node ancestor node appears click on the state |
hover-start-time | number | 20 | no | How long have click-state milliseconds after holding down |
hover-stay-time | number | 70 | no | After you release your finger click-state retention time, in milliseconds |
only | string | in | no | Specifies the return user information language , zh_CN Simplified Chinese, zh_TW Traditional Chinese, en English. |
session-from | string | no | When open-type = "contact" effective , session sources, | |
send-message-title | string | Current title | no | When the open-type = "contact" valid card within the session message header, open-type = "contact" effective |
send-message-path | string | Share current path | no | When the open-type = "contact" valid, a session message card applet path Clicked |
send-message-img | string | Screenshot | no | When the open-type = "contact" valid, the session message card image |
app-parameter | string | no | When the open-type = "contact" active open APP, APP parameter transmitted to | |
show-message-card | boolean | false | no | When open-type = "contact" effective, whether to display a message in the card session, set this parameter to true, the user enters the customer service conversations will show "applet may want to send a" prompt, the user clicks can quickly send a small program in the lower right corner news |
bindgetuserinfo | eventhandle | no | effective, when the user clicks the button, it will return to obtain user information, data and when the callback detail-of the type = Open "Business Card" wx.getUserInfo consistent return | |
bindcontact | eventhandle | no | = time when the open-type "contact" valid customer callback message, open-type = "contact" effective | |
bindgetphonenumber | eventhandle | no | 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 | 繁体中文 |