HomeDocs
Skip to main content

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

AttributeDescriptionTypeDefault Value
typeThe type of the button, can be default, primary, secondary, warn, or unsetStringdefault
sizeThe size of the button, can be large, small, mini, normal, or unsetStringnormal
longWhen enabled, the button's width is set to 100%BooleanFALSE
disabledSets the button to a disabled stateBooleanFALSE
loadingSets the button to a loading stateBooleanFALSE

Events

NameDescriptionCallback Parameters
tapTriggered on clickEvent

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;
}
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.