switch
Radio item.
Attribute Name | Type | Default | Description | Minimum Version |
name | String | Component name, used for form submission to get data | ||
checked | Boolean | checked or not | ||
disabled | Boolean | disable or not | ||
color | String | component color | ||
onChange | EventHandle | trigger on checked change, event.detail={ value:checked} | ||
color | Color | switch color |
Screenshot
Sample Code
copy
<view class="page">
<view class="switch-list">
<view class="switch-item">
<switch checked onChange="switchChange"/>
</view>
</view>
</view>
copy
Page({
switchChange (e){
console.log('switchChange event, value:', e.detail.value)
},
})