2020-07-28 10:03:53 +08:00
|
|
|
---
|
|
|
|
title: Switch 开关
|
2021-01-07 23:35:03 +08:00
|
|
|
description:
|
2020-07-28 10:03:53 +08:00
|
|
|
type: 0
|
|
|
|
group: ⚙ 组件
|
|
|
|
menuName: Switch
|
2021-01-07 23:35:03 +08:00
|
|
|
icon:
|
2020-07-28 10:03:53 +08:00
|
|
|
order: 66
|
|
|
|
---
|
2021-01-07 23:35:03 +08:00
|
|
|
|
2020-07-28 10:03:53 +08:00
|
|
|
## 基本用法
|
|
|
|
|
2021-03-17 10:24:59 +08:00
|
|
|
常见的用法是放 CRUD 中
|
|
|
|
|
|
|
|
```schema: scope="body"
|
2020-07-28 10:03:53 +08:00
|
|
|
{
|
2021-03-17 10:24:59 +08:00
|
|
|
"type": "crud",
|
|
|
|
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample",
|
|
|
|
"quickSaveItemApi": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample/$id",
|
|
|
|
"syncLocation": false,
|
|
|
|
"columns": [
|
|
|
|
{
|
|
|
|
"name": "id",
|
|
|
|
"type": "switch",
|
|
|
|
"label": "switch"
|
|
|
|
}
|
|
|
|
]
|
2020-07-28 10:03:53 +08:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-03-14 16:07:37 +08:00
|
|
|
## 属性表
|
|
|
|
|
2020-07-28 10:03:53 +08:00
|
|
|
| 属性名 | 类型 | 默认值 | 说明 |
|
|
|
|
| --------- | -------- | ------ | ------------------------------- |
|
|
|
|
| type | `string` | | `"switch"` 指定为 Dialog 渲染器 |
|
|
|
|
| className | `string` | | 外层 Dom 的类名 |
|
|
|
|
| trueValue | any | | 真值,当值为该值时,开关开启 |
|
|
|
|
| option | `string` | | 右侧选项文本 |
|