# switch
## Instructions
开关选择器。
属性说明
示例 查看演示
### Syntax
- 使用 ``(或 ``,当需要包裹子节点时)。
- 遇到平台差异时,建议使用条件编译(`#ifdef / #endif`)显式处理。
#### Properties
| 属性名 | 类型 | 默认值 | 说明 | 平台差异说明 |
| --- | --- | --- | --- | --- |
| checked | Boolean | false | 是否选中 | |
| disabled | Boolean | false | 是否禁用 | 抖音小程序与飞书小程序不支持 |
| type | String | switch | 样式,有效值:switch, checkbox | |
| color | Color | - | switch 的颜色,同 css 的 color | |
#### Events
| 事件名 | 类型 | 默认值 | 说明 | 平台差异说明 |
| --- | --- | --- | --- | --- |
| @change | EventHandle | - | checked 改变时触发 change 事件,event.detail={ value:checked} | |
#### Platform Compatibility
See official docs for platform support table: `https://doc.dcloud.net.cn/uni-app-x/component/switch.html`
### Examples
### Example (Example 1)
```vue
默认样式
不同颜色和尺寸的switch
推荐展示样式
开启中
关闭
```
### Example (Example 2)
```vue
默认样式
不同颜色和尺寸的switch
推荐展示样式
开启中
关闭
```
### Example (Example 3)
```vue
```
Reference: [Official Documentation](https://doc.dcloud.net.cn/uni-app-x/component/switch.html)