fix: 行列容器组件纵向分割大于2的时候报错 (#474)

* fix: 行列容器组件纵向分割大于2的时候报错
This commit is contained in:
Gene 2024-05-16 20:41:10 -07:00 committed by GitHub
parent 0d36df07a7
commit 47c71d1129
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 12 deletions

View File

@ -43,7 +43,8 @@ const ROW_SNIPPET = {
grow: true, grow: true,
shrink: true, shrink: true,
widthType: 'auto' widthType: 'auto'
} },
children: []
} }
] ]
} }
@ -103,16 +104,7 @@ export default {
if (schema.componentName === 'CanvasCol') { if (schema.componentName === 'CanvasCol') {
// //
if (!schema.children?.length) { if (!schema.children?.length) {
schema.children = [ schema.children = [extend(true, {}, ROW_SNIPPET), extend(true, {}, ROW_SNIPPET)]
{
...extend(true, {}, ROW_SNIPPET),
children: [{ ...extend(true, {}, COL_SNIPPET) }]
},
{
...extend(true, {}, ROW_SNIPPET),
children: [{ ...extend(true, {}, COL_SNIPPET) }]
}
]
} else if (schema.children[0].componentName !== 'CanvasRow') { } else if (schema.children[0].componentName !== 'CanvasRow') {
// row children row col // row children row col
schema.children = [ schema.children = [
@ -129,7 +121,7 @@ export default {
] ]
} else { } else {
// //
schema.children.push(...extend(true, {}, ROW_SNIPPET)) schema.children.push(extend(true, {}, ROW_SNIPPET))
} }
} }