开关选择器
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
checked | boolean | false | 是否选中 | |
disabled | boolean | false | 是否禁用 | |
type | string | switch | 样式,有效值:switch, checkbox | |
color | string | #04BE02 | switch 的颜色,同 css 的 color | |
bindchange | eventhandle | checked 改变时触发 change 事件,event.detail={ value} |
<view class="container"> <switch checked color="rgba(255, 36, 66, 1)" style="--a4abe58c: #777;"/> <switch class="_ml8" checked color="rgba(255, 36, 66, 0.4)" disabled/> <switch class="_ml8" checked="{{false}}" color="rgba(255, 36, 66, 1)"/> <switch class="_ml8" color="rgba(255, 36, 66, 1)"/> <view class="_dflex _jc_space-between _py6 _ai_center"> <text> 标题描述 </text> <switch checked color="rgba(255, 36, 66, 1)"/> </view> <view class="_dflex _jc_space-between _py6 _ai_center"> <view> <view class="switch_font_title"> 标题描述 </view> <view class="switch_font_sub"> 可添加二级描述文本 </view> </view> <switch checked="{{false}}" color="rgba(255, 36, 66, 1)"/> </view> </view>