HomeDocs
Skip to main content

Switch

Introduction

Switch is used to toggle options on or off.

Property Description

FieldDescriptionTypeDefault
activeThe state of the switch.BooleanFALSE
sizeThe size of the switch. Options: small/base/largeStringbase
disabledWhether the switch is disabled.BooleanFALSE
labelInline text label, separated by a vertical line. e.g. ON / OFFString

Events

NameDescriptionCallback Parameters
changeTriggered when toggledvalue

Example

<view class="bg-white br4 pd16">
<mswitch size="large" :active="false" bind:change="handleSwitch"></mswitch>
</view>
Page({
data: {},
handleSwitch(val) {
console.log('switch====', val);
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.