Skip to content

Commit 0646273

Browse files
committed
fix(preview): multiple nested blocks cannot preview opentiny#663
1 parent e651dff commit 0646273

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • packages/design-core/src/preview/src/preview

‎packages/design-core/src/preview/src/preview/Preview.vue‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,17 @@ export default {
8686
.map((name) => fetchBlockSchema(name))
8787
8888
const schemaList = await Promise.allSettled(promiseList)
89+
const extraList = []
8990
9091
schemaList.forEach((item) => {
9192
if (item.status === 'fulfilled' && item.value?.[0]?.content) {
9293
res.push(item.value[0].content)
93-
res.push(...getBlocksSchema(item.value[0].content, blockSet))
94+
extraList.push(getBlocksSchema(item.value[0].content, blockSet))
95+
}
96+
})
97+
;(await Promise.allSettled(extraList)).forEach((item) => {
98+
if (item.status === 'fulfilled' && item.value) {
99+
res.push(...item.value)
94100
}
95101
})
96102
@@ -136,11 +142,10 @@ export default {
136142
},
137143
...(blocks || []).map((blockSchema) => {
138144
return {
139-
panelName: blockSchema.fileName,
145+
panelName: `${blockSchema.fileName}.vue`,
140146
panelValue:
141147
genSFCWithDefaultPlugin(blockSchema, appData?.componentsMap || [], { blockRelativePath: './' }) || '',
142-
panelType: 'vue',
143-
index: true
148+
panelType: 'vue'
144149
}
145150
})
146151
]

0 commit comments

Comments
 (0)