Skip to content

Commit

Permalink
fix: 简化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
gene9831 committed May 13, 2024
1 parent bf879b4 commit 69274e1
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions packages/canvas/src/components/container/CanvasDivider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,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,10 +120,7 @@ export default {
]
} else {
// 已经切割过了,直接加一行
schema.children.push({
...extend(true, {}, ROW_SNIPPET),
children: [{ ...extend(true, {}, COL_SNIPPET) }]
})
schema.children.push(extend(true, {}, ROW_SNIPPET))
}
}
Expand Down

0 comments on commit 69274e1

Please sign in to comment.