roymondchen 873a51fc87 docs: 升级 VitePress 至 v2 alpha,类型引用改为源码片段同步
- 升级 vitepress 到 ^2.0.0-alpha.17
- vite.optimizeDeps.rolldownOptions.transform.define 迁移至 vite.define 以适配 v2 API
- 同步升级 vitest/rolldown/vue/vite 等周边依赖
- 文档中类型链接统一改为 <<< 片段引用源码 region,避免 commit hash 链接失效
- packages/{core,editor,form-schema,schema,stage} 相关类型加 // #region 锚点
- 移除已废弃的 docs/guide/advanced/tmagic-ui.md 及侧栏入口

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 11:47:03 +08:00

247 lines
4.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 布局
## 配置类型
::: details 查看 ContainerCommonConfig / RowConfig / TabConfig / TabPaneConfig / FieldsetConfig / PanelConfig / StepConfig / FlexLayoutConfig / GroupListConfig / TableConfig / TableColumnConfig / TableGroupListCommonConfig 配置类型定义
<<< @/../packages/form-schema/src/base.ts#ContainerCommonConfig{ts}
<<< @/../packages/form-schema/src/base.ts#RowConfig{ts}
<<< @/../packages/form-schema/src/base.ts#TabConfig{ts}
<<< @/../packages/form-schema/src/base.ts#TabPaneConfig{ts}
<<< @/../packages/form-schema/src/base.ts#FieldsetConfig{ts}
<<< @/../packages/form-schema/src/base.ts#PanelConfig{ts}
<<< @/../packages/form-schema/src/base.ts#StepConfig{ts}
<<< @/../packages/form-schema/src/base.ts#FlexLayoutConfig{ts}
<<< @/../packages/form-schema/src/base.ts#GroupListConfig{ts}
<<< @/../packages/form-schema/src/base.ts#TableConfig{ts}
<<< @/../packages/form-schema/src/base.ts#TableColumnConfig{ts}
<<< @/../packages/form-schema/src/base.ts#TableGroupListCommonConfig{ts}
<<< @/../packages/form-schema/src/base.ts#FormItem{ts}
:::
## 基础用法
<demo-block type="form" :config="[{
name: 'text',
text: '配置1',
}, {
name: 'text2',
text: '配置2',
}, {
name: 'text3',
text: '配置3',
}]"></demo-block>
## 行内布局
可以通过配置span来指定行内的配置项占用多少位置一行为24例如一行要显示三个配置则 span 可以配置 8四个则为 6。默认会自动调节在一行中显示。
<demo-block type="form" :config="[{
type: 'row',
labelWidth: '100px',
span: 8,
items: [{
name: 'text',
text: '配置1',
}, {
name: 'text2',
text: '配置2',
}, {
name: 'text3',
text: '配置3',
}]
}, {
type: 'row',
span: 12,
labelWidth: '100px',
items: [{
name: 'text4',
text: '配置1',
}, {
name: 'text5',
text: '配置2',
}, {
name: 'text6',
text: '配置3',
}]
}]"></demo-block>
## 混合布局
<demo-block type="form" :config="[{
name: 'text0',
labelWidth: '100px',
text: '配置0',
}, {
type: 'row',
labelWidth: '100px',
items: [{
name: 'text',
text: '配置1',
}, {
name: 'text2',
text: '配置2',
}, {
name: 'text3',
text: '配置3',
}]
}]"></demo-block>
## 对象容器
### Object
<demo-block type="form" :config="[{
name: 'data',
items: [{
name: 'text2',
text: '配置2',
}, {
name: 'text3',
text: '配置3',
}]
}]"></demo-block>
### fieldset
<demo-block type="form" :config="[{
type: 'fieldset',
labelWidth: '100px',
legend: 'fieldset',
items: [{
name: 'text',
text: '配置1',
}, {
type: 'row',
items: [{
name: 'text2',
text: '配置2',
}, {
name: 'text3',
text: '配置3',
}]
}]
}]"></demo-block>
### panel
<demo-block type="form" :config="[{
type: 'panel',
title: 'panel',
items: [{
name: 'text',
text: '配置1',
}, {
type: 'row',
items: [{
name: 'text2',
text: '配置2',
}, {
name: 'text3',
text: '配置3',
}]
}]
}]"></demo-block>
### tabs
<demo-block type="form" :config="[{
type: 'tab',
items: [{
title: 'tab1',
items: [{
name: 'text',
text: '配置1',
}]
}, {
title: 'tab2',
items: [{
name: 'text2',
text: '配置2',
}, {
name: 'text3',
text: '配置3',
}]
}]
}]"></demo-block>
## 数组容器
### groupList
<demo-block type="form" :config="[{
type: 'groupList',
name: 'group',
items: [{
name: 'text',
text: '配置1',
}, {
type: 'row',
items: [{
name: 'text2',
text: '配置2',
}, {
name: 'text3',
text: '配置3',
}]
}]
}]"></demo-block>
### table
<demo-block type="form" :config="[{
type: 'table',
name: 'table',
items: [{
name: 'text',
label: '配置1',
}]
}]"></demo-block>
### step
<demo-block type="form" :config="[{
type: 'step',
items: [{
title: '步骤1',
items: [{
name: 'text',
text: '配置1',
}]
}, {
title: '步骤2',
items: [{
name: 'text2',
text: '配置2',
}]
}]
}]"></demo-block>
### flex-layout
<demo-block type="form" :config="[{
type: 'flex-layout',
gap: '20px',
items: [{
name: 'text',
text: '配置1',
span: 12
}, {
name: 'text2',
text: '配置2',
span: 12
}]
}]"></demo-block>