Skip to content

Commit

Permalink
fix: 行列容器组件纵向分割大于2的时候报错 (#474)
Browse files Browse the repository at this point in the history
* fix: 行列容器组件纵向分割大于2的时候报错
  • Loading branch information
gene9831 authored May 17, 2024
1 parent 0d36df0 commit 47c71d1
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions packages/canvas/src/components/container/CanvasDivider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const ROW_SNIPPET = {
grow: true,
shrink: true,
widthType: 'auto'
}
},
children: []
}
]
}
Expand Down Expand Up @@ -103,16 +104,7 @@ export default {
if (schema.componentName === 'CanvasCol') {
// 当前组件为空组件,直接切成两行
if (!schema.children?.length) {
schema.children = [
{
...extend(true, {}, ROW_SNIPPET),
children: [{ ...extend(true, {}, COL_SNIPPET) }]
},
{
...extend(true, {}, ROW_SNIPPET),
children: [{ ...extend(true, {}, COL_SNIPPET) }]
}
]
schema.children = [extend(true, {}, ROW_SNIPPET), extend(true, {}, ROW_SNIPPET)]
} else if (schema.children[0].componentName !== 'CanvasRow') {
// 当前组件不为空组件且第一个孩子不为 row,则是第一次切割,切割成两行,需要将原来有的 children 放置到第一个 row 的 col
schema.children = [
Expand All @@ -129,7 +121,7 @@ export default {
]
} else {
// 已经切割过了,直接加一行
schema.children.push(...extend(true, {}, ROW_SNIPPET))
schema.children.push(extend(true, {}, ROW_SNIPPET))
}
}
Expand Down

0 comments on commit 47c71d1

Please sign in to comment.