Skip to content

Commit

Permalink
fix(preview): multiple nested blocks cannot preview opentiny#663 (ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
chilingling authored Jul 22, 2024
1 parent fec563d commit fd164a1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/design-core/src/preview/src/preview/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,17 @@ export default {
.map((name) => fetchBlockSchema(name))
const schemaList = await Promise.allSettled(promiseList)
const extraList = []
schemaList.forEach((item) => {
if (item.status === 'fulfilled' && item.value?.[0]?.content) {
res.push(item.value[0].content)
res.push(...getBlocksSchema(item.value[0].content, blockSet))
extraList.push(getBlocksSchema(item.value[0].content, blockSet))
}
})
;(await Promise.allSettled(extraList)).forEach((item) => {
if (item.status === 'fulfilled' && item.value) {
res.push(...item.value)
}
})
Expand Down Expand Up @@ -136,11 +142,10 @@ export default {
},
...(blocks || []).map((blockSchema) => {
return {
panelName: blockSchema.fileName,
panelName: `${blockSchema.fileName}.vue`,
panelValue:
genSFCWithDefaultPlugin(blockSchema, appData?.componentsMap || [], { blockRelativePath: './' }) || '',
panelType: 'vue',
index: true
panelType: 'vue'
}
})
]
Expand Down

0 comments on commit fd164a1

Please sign in to comment.