switch
Switch.
Property | Type | Description |
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)
},
})