amis2/docs/zh-CN/components/switch.md

39 lines
1010 B
Markdown
Raw Normal View History

2020-07-28 10:03:53 +08:00
---
title: Switch 开关
description:
2020-07-28 10:03:53 +08:00
type: 0
group: ⚙ 组件
menuName: Switch
icon:
2020-07-28 10:03:53 +08:00
order: 66
---
2020-07-28 10:03:53 +08:00
## 基本用法
常见的用法是放 CRUD 中
```schema: scope="body"
2020-07-28 10:03:53 +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
}
```
## 属性表
2020-07-28 10:03:53 +08:00
| 属性名 | 类型 | 默认值 | 说明 |
| --------- | -------- | ------ | ------------------------------- |
| type | `string` | | `"switch"` 指定为 Dialog 渲染器 |
| className | `string` | | 外层 Dom 的类名 |
| trueValue | any | | 真值,当值为该值时,开关开启 |
| option | `string` | | 右侧选项文本 |