One UI

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

OneSpace 属性
名称签名说明
directiondirection?: 'horizontal' | 'vertical'排列方向,默认 horizontal。
sizesize?: OneComponentSize | number间距,sm/md/lg 或像素值,默认 md。
wrapwrap?: boolean允许子元素换行。
alignalign?: OneSpaceAlign子元素对齐方式。
childrenchildren?: Array<VNode | string>排布的内容。