Skip to content

Commit

Permalink
fix(Layout): 修复布局组件动态子级,组件计算存在问题
Browse files Browse the repository at this point in the history
  • Loading branch information
D-xuanmo committed Jun 4, 2024
1 parent 1e64431 commit f10eb56
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/dl-common/src/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ export default defineComponent({
const columnsMap = reactive<Map<string, string>>(new Map())
const rows: Map<string, string> = new Map()
const children = ref<VNode[]>([])
const ids: Record<string, string> = {
layout: createRandomID(8),
'layout-header': createRandomID(8),
'layout-footer': createRandomID(8),
'layout-content': createRandomID(8)
}

const initialChildren = () => {
rows.clear()
columnsMap.clear()
children.value = findChildren(context.slots.default?.() ?? []).map((item: any) => {
const layoutId = createRandomID(8)
const compName = getComponentName(item.type?.name)
const layoutId = ids[compName] || createRandomID(8)
item.props = {
...item.props,
layoutId
}
const compName = getComponentName(item.type?.name)
/* eslint-disable indent */
switch (compName) {
case 'layout':
Expand Down

0 comments on commit f10eb56

Please sign in to comment.