button
Description
The Button component represents a button.
Usage Restrictions
After version 0.13.0 of the MiniApp IDE, the mbutton tag has been corrected to button, while also being compatible with the previous version of mbutton. If the project uses properties and events other than those listed below, please make changes accordingly.
Attribute Description
Attribute | Description | Type | Default Value |
---|---|---|---|
type | The type of the button, can be default, primary, secondary, warn, or unset | String | default |
size | The size of the button, can be large, small, mini, normal, or unset | String | normal |
long | When enabled, the button's width is set to 100% | Boolean | FALSE |
disabled | Sets the button to a disabled state | Boolean | FALSE |
loading | Sets the button to a loading state | Boolean | FALSE |
Events
Name | Description | Callback Parameters |
---|---|---|
tap | Triggered on click | Event |
Example
Code Example
<view class="pd16">
<view class="bg-white br4 pd16">
<button size="normal" type="default" :loading="false">
default button
</button>
<button size="large" type="primary" :loading="false">
large info button
</button>
<button size="small" type="warn" :loading="true">
small danger loading button
</button>
</view>
</view>
.pd16 {
padding: 16px;
}
.br4 {
border-radius: 4px;
}
.bg-white {
background-color: #fff;
}