2020-07-28 10:03:53 +08:00
|
|
|
---
|
|
|
|
title: Range 滑块
|
2021-01-07 23:35:03 +08:00
|
|
|
description:
|
2020-07-28 10:03:53 +08:00
|
|
|
type: 0
|
|
|
|
group: null
|
|
|
|
menuName: Range 范围
|
2021-01-07 23:35:03 +08:00
|
|
|
icon:
|
2020-07-28 10:03:53 +08:00
|
|
|
order: 38
|
|
|
|
---
|
2021-01-07 23:35:03 +08:00
|
|
|
|
|
|
|
可以用于选择单个数值或数值范围。
|
|
|
|
|
2020-07-28 10:03:53 +08:00
|
|
|
## 基本用法
|
|
|
|
|
2021-01-07 23:35:03 +08:00
|
|
|
默认是单个数值,结果是个整数。
|
|
|
|
|
|
|
|
```schema: scope="body"
|
2020-07-28 10:03:53 +08:00
|
|
|
{
|
|
|
|
"type": "form",
|
2021-01-19 10:20:09 +08:00
|
|
|
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm",
|
2020-07-28 10:03:53 +08:00
|
|
|
"controls": [
|
|
|
|
{
|
|
|
|
"type": "range",
|
|
|
|
"name": "range",
|
|
|
|
"label": "range"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## 选择范围
|
|
|
|
|
2021-01-07 23:35:03 +08:00
|
|
|
对于范围的渲染,结果将是个字符串,两个数值通过分隔符来隔开。
|
|
|
|
|
|
|
|
```schema: scope="body"
|
2020-07-28 10:03:53 +08:00
|
|
|
{
|
|
|
|
"type": "form",
|
|
|
|
"debug": true,
|
2021-01-19 10:20:09 +08:00
|
|
|
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm",
|
2020-07-28 10:03:53 +08:00
|
|
|
"controls": [
|
|
|
|
{
|
|
|
|
"type": "range",
|
|
|
|
"name": "range",
|
|
|
|
"label": "range",
|
|
|
|
"multiple": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## 属性表
|
|
|
|
|
|
|
|
当做选择器表单项使用时,除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
|
|
|
|
|
|
|
|
| 属性名 | 类型 | 默认值 | 说明 |
|
|
|
|
| ---------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
| className | `string` | | css 类名 |
|
|
|
|
| min | `number` | | 最小值 |
|
|
|
|
| max | `number` | | 最大值 |
|
|
|
|
| step | `number` | | 步长 |
|
|
|
|
| multiple | `boolean` | `false` | 支持选择范围 |
|
|
|
|
| joinValuse | `boolean` | `true` | 默认为 `true`,选择的 `value` 会通过 `delimiter` 连接起来,否则直接将以`{min: 1, max: 100}`的形式提交,开启`multiple`时有效 |
|
2021-01-07 23:35:03 +08:00
|
|
|
| delimiter | `string` | `,` | 分隔符 |
|
2020-07-28 10:03:53 +08:00
|
|
|
| unit | `string` | | 单位 |
|
|
|
|
| clearable | `boolean` | | 是否可清除 |
|
|
|
|
| showInput | `string` | | 是否显示输入框 |
|