2020-03-22 11:38:02 +08:00
|
|
|
|
---
|
|
|
|
|
category: Components
|
|
|
|
|
type: 布局
|
|
|
|
|
subtitle: 间距
|
|
|
|
|
title: Space
|
|
|
|
|
cols: 1
|
2020-05-31 11:48:34 +08:00
|
|
|
|
cover: https://gw.alipayobjects.com/zos/antfincdn/wc6%263gJ0Y8/Space.svg
|
2020-03-22 11:38:02 +08:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
设置组件之间的间距。
|
|
|
|
|
|
|
|
|
|
## 何时使用
|
|
|
|
|
|
|
|
|
|
避免组件紧贴在一起,拉开统一的空间。
|
|
|
|
|
|
2020-08-03 13:56:58 +08:00
|
|
|
|
- 适合行内元素的水平间距。
|
|
|
|
|
- 可以设置各种水平对齐方式。
|
2022-10-18 16:23:10 +08:00
|
|
|
|
- 需要表单组件之间紧凑连接且合并边框时,使用 Space.Compact(自 antd@4.24.0 版本开始提供该组件。)。
|
2020-08-03 13:56:58 +08:00
|
|
|
|
|
2020-03-22 11:38:02 +08:00
|
|
|
|
## API
|
|
|
|
|
|
2022-10-18 16:23:10 +08:00
|
|
|
|
### Space
|
|
|
|
|
|
2020-10-21 10:33:43 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
2022-07-22 14:14:01 +08:00
|
|
|
|
| align | 对齐方式 | `start` \| `end` \|`center` \|`baseline` | - | 4.2.0 |
|
2020-10-21 10:33:43 +08:00
|
|
|
|
| direction | 间距方向 | `vertical` \| `horizontal` | `horizontal` | 4.1.0 |
|
2020-11-27 13:40:40 +08:00
|
|
|
|
| size | 间距大小 | [Size](#Size) \| [Size\[\]](#Size) | `small` | 4.1.0 \| Array: 4.9.0 |
|
2020-10-21 10:33:43 +08:00
|
|
|
|
| split | 设置拆分 | ReactNode | - | 4.7.0 |
|
2020-11-27 13:40:40 +08:00
|
|
|
|
| wrap | 是否自动换行,仅在 `horizontal` 时有效 | boolean | false | 4.9.0 |
|
|
|
|
|
|
|
|
|
|
### Size
|
|
|
|
|
|
|
|
|
|
`'small' | 'middle' | 'large' | number`
|
2022-10-18 16:23:10 +08:00
|
|
|
|
|
|
|
|
|
### Space.Compact
|
|
|
|
|
|
|
|
|
|
> 自 antd@4.24.0 版本开始提供该组件。
|
|
|
|
|
|
|
|
|
|
需要表单组件之间紧凑连接且合并边框时,使用 Space.Compact。支持的组件有:
|
|
|
|
|
|
|
|
|
|
- Button
|
|
|
|
|
- AutoComplete
|
|
|
|
|
- Cascader
|
|
|
|
|
- DatePicker
|
|
|
|
|
- Input/Input.Search
|
|
|
|
|
- Select
|
|
|
|
|
- TimePicker
|
|
|
|
|
- TreeSelect
|
|
|
|
|
|
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
|
|
|
|
| block | 将宽度调整为父元素宽度的选项 | boolean | false | 4.24.0 |
|
|
|
|
|
| direction | 指定排列方向 | `vertical` \| `horizontal` | `horizontal` | 4.24.0 |
|
|
|
|
|
| size | 子组件大小 | `large` \| `middle` \| `small` | `middle` | 4.24.0 |
|