# button
Start from base library version 1.0.0. Please remaining backward compatible.
Button.
attribute | type | Default value | Required | Introductions | Minimum version |
---|---|---|---|---|---|
size | string | default | no | Button size | 1.0.0 |
type | string | default | no | Style type of on | 1.0.0 |
plain | boolean | false | no | Whether the on is hollow, the background color is transparent | 1.0.0 |
disabled | boolean | false | no | Is it disabled? | 1.0.0 |
loading | boolean | false | no | Does the name come with loading icon | 1.0.0 |
form-type | string | no | Used for form Component, click separately to trigger form Component submit/reset event | 1.0.0 | |
open-type | string | no | WeChat open ability | 1.1.0 | |
hover-class | string | button-hover | no | Specifies the style class for which the on is pressed. when hover-class="none" There is no click state effect | 1.0.0 |
hover-stop-propagation | boolean | false | no | Specifies whether to prevent this node's ancestor from clicking | 1.5.0 |
hover-start-time | number | 20 | no | How long does it take to click, in milliseconds? | 1.0.0 |
hover-stay-time | number | 70 | no | Click hold time after finger release, in milliseconds | 1.0.0 |
long | string | in | no | Specifies the language in which user information is returned, zh_CN Simplified Chinese, en_TW Traditional Chinese, en English. | 1.3.0 |
session-from | string | no | Session source, open type = "contact" | 1.4.0 | |
send-message-title | string | Current title | no | In-session message card title, valid when opentype = "contact" | 1.5.0 |
send-message-path | string | Current sharing path | no | The in-session message card is valid when it clicks the jump Mini Program path, open-type = "contact" | 1.5.0 |
send-message-img | string | screenshot | no | Picture of in-session message card, valid when opentype = "contact" | 1.5.0 |
app-parameter | string | no | open APP When, to APP The parameter passed is valid when open-type = launchApp | 1.9.5 | |
show-message-card | boolean | false | no | Whether to display an in-session message card, set this parameter to True, users entering the customer service session will display "may want to send Mini Program" prompt in the lower right corner, users can click on the Mini Program can quickly send a message, open type = "contact" valid | 1.5.0 |
bindgetuserinfo | eventhandle | no | When the user clicks the on, the user information will be returned.[wx.getUserInfo]((wx.getUserInfo) returns consistent, open-type."getUserInfo" is valid | 1.3.0 | |
bindcontact | eventhandle | no | Customer service message callback, valid when opentype = "contact" | 1.5.0 | |
bindgetphonenumber | eventhandle | no | Gets the user's phone number callback, valid when open-type = getPhoneNumber | 1.2.0 | |
binderror | eventhandle | no | A bad callback occurs when using open capabilities. Valid when open-type = launchApp | 1.9.5 | |
bindopensetting | eventhandle | no | Callback after opening the authorization settings page, open type = openSetting | 2.0.7 | |
bindlaunchapp | eventhandle | no | open APP Successful callback, open type = launchApp | 2.4.4 |
size Legal value
value | Introductions | Minimum version |
---|---|---|
default | Default Size | |
mini | Small size |
type Legal value
value | Introductions | Minimum version |
---|---|---|
primary | green | |
default | white | |
warn | red |
form-type Legal value
value | Introductions | Minimum version |
---|---|---|
submit | Submit form | |
reset | Reset Form |
open-type Legal value
value | Introductions | Minimum version |
---|---|---|
contact | Open the customer service session, if the user clicks the message card in the session and returns the Mini Program, you can start from the bindcontact To obtain specific information in the callback,explicit explanation (The Mini Program plug-in cannot be used) | 1.1.0 |
share | Trigger the user to forward, recommend reading before useGuidelines for Use | 1.2.0 |
getPhoneNumber | Get the user's phone number, which can be obtained from the bind get phone number callback,explicit explanation (The Mini Program plug-in cannot be used) | 1.2.0 |
getUserInfo | Get user information, which you can get from the bind get userinfo callback (The Mini Program plug-in cannot be used) | 1.3.0 |
launchApp | Open the app, you can set the parameters to the app through the app-parameter attributeexplicit explanation | 1.9.5 |
openSetting | Open Authorization Settings Page | 2.0.7 |
feedback | Open the "feedback" page, users can submit feedback content and upload [journal]((wx.getLogManager), where developers can log in Mini Program management background Enter the left menu "customer service feedback" page to get feedback content | 2.1.0 |
long Legal value
value | Introductions | Minimum version |
---|---|---|
in | English | |
zh_CN | Simplified Chinese | |
zh_TW | Traditional Chinese |
# Bug & Tip
tip
:button-hover
Default is{background-color: rgba(0, 0, 0, 0.1) opacity: 0.7}
tip
:bindgetphonenumber
From 1.2.0 Started support, but not available in versions below 1.5.3wx.canIUse for testing, it is recommended to use the base library version for judgment.tip
: inbindgetphonenumber
Called in a callback that returns encrypted information wx.login Login, may refresh the login state. At this point the server uses code In exchange for sessionKey It's not encrypted. Session Key, causing decryption to fail. Developers are advised to advancelogin
Or use thecheckSession
Perform login status checks to avoidlogin
Refresh login status.tip
: from 2.1.0 Start, button Can be embedded as a child node of a native component for use on a native assemblyopen-type
The ability.tip
: Currently setform-type
ofbutton
Object in the current componentform
Effective. Thus, willbutton
Is encapsulated in a custom component, andform
In addition to the custom component, thebutton
ofform-type
Failure.