|
@@ -50,22 +50,28 @@ export const store = EditorModule.store({
|
|
|
previewImageList(state) {
|
|
|
const res: string[] = [];
|
|
|
|
|
|
- function findImg(comp: DesignComp) {
|
|
|
- (comp?.children?.default
|
|
|
- ? comp?.children?.default
|
|
|
- : Object.values(comp?.children)
|
|
|
- ).forEach((k: string) => {
|
|
|
- const comp = state.designData.compMap[k];
|
|
|
- if (comp.compKey == "Image") {
|
|
|
- res.push(comp.value?.url);
|
|
|
+ function deepChild(item: any) {
|
|
|
+ if (typeof item == "string") {
|
|
|
+ const comp = state.designData.compMap[item];
|
|
|
+ if (comp.compKey === "Image") {
|
|
|
+ res.push(comp.value.url);
|
|
|
+ } else if (comp.children) {
|
|
|
+ deepChild(comp.children);
|
|
|
+ }
|
|
|
+ } else if (item instanceof Object) {
|
|
|
+ if (item instanceof Array) {
|
|
|
+ item.forEach((d) => {
|
|
|
+ deepChild(d);
|
|
|
+ });
|
|
|
} else {
|
|
|
- findImg(comp);
|
|
|
+ Object.values(item).forEach((d) => {
|
|
|
+ deepChild(d);
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
+ deepChild(state.designData.compMap["root"].children);
|
|
|
|
|
|
- const root = state.designData.compMap["root"];
|
|
|
- findImg(root);
|
|
|
return res;
|
|
|
},
|
|
|
},
|