组件
OneSpace
OneSpace 把子元素按水平或垂直方向排布,并用统一间距分隔,避免手动设置 margin。
查看代码收起代码
import { OneSpace } from '@geektech/one';
import { OneButton } from '@geektech/one';
new OneSpace({ size: 'md', children: [
{ component: OneButton, props: { variant: 'primary' }, children: ['保存'] },
{ component: OneButton, props: {}, children: ['取消'] },
]);间距与对齐
size 接受 sm/md/lg 或像素数值;align 控制子元素对齐,wrap 允许换行。
API
| 名称 | 签名 | 说明 |
|---|---|---|
direction | direction?: 'horizontal' | 'vertical' | 排列方向,默认 horizontal。 |
size | size?: OneComponentSize | number | 间距,sm/md/lg 或像素值,默认 md。 |
wrap | wrap?: boolean | 允许子元素换行。 |
align | align?: OneSpaceAlign | 子元素对齐方式。 |
children | children?: Array<VNode | string> | 排布的内容。 |