qinyan 1 жил өмнө
parent
commit
18d6c5512b

+ 1 - 1
src/modules/editor/components/CompUI/customUI/Cards/CardList/component.tsx

@@ -35,7 +35,7 @@ export const Component = createUIComp({
           gridGap: helper.designToNaturalSize(value.gap),
         }}
       >
-        {children.list.map((d, i) => (
+        {children.list?.map((d, i) => (
           <div key={i}>
             <Image.Component
               class="overflow-hidden"

+ 1 - 1
src/modules/editor/components/PreviewImagesModal/index.tsx

@@ -4,7 +4,7 @@ import { array, string } from "vue-types";
 
 export default defineComponent({
   props: {
-    data: array<string>().isRequired,
+    data: array<string>().def([]),
     current: string().isRequired,
   },
   setup(props) {

+ 1 - 0
src/modules/editor/components/Viewport/Slider/SliderRight/CompTree.tsx

@@ -38,6 +38,7 @@ export const CompTreeMain = defineComponent({
 
         let deep = 0;
         function getCompChildren(ids: string[]): TreeItem[] {
+          if (!ids) return [];
           deep += 1;
           if (deep > 2) ids = [...ids].reverse();
 

+ 1 - 1
src/modules/editor/controllers/ScreenCtrl/index.ts

@@ -260,7 +260,7 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
          const card = compMap[c] as DesignComp;
          const screenCard :CardState = {
             id: c,
-            size: [card.layout.size[0], card.layout.size[1]],
+            size: [card.layout?.size?.[0], card.layout?.size?.[1]],
             children: []
          }
          let childrs = card.children.default || [];

+ 6 - 1
src/modules/editor/module/actions/image.tsx

@@ -36,7 +36,12 @@ export const ImgCompActions = EditorModule.action({
     // }
   },
   previewImage(url, previewImageList) {
-    if (this.controls.screenCtrl.state.screen.useFor == "pc") return;
+    if (
+      this.controls.screenCtrl.state.screen.useFor == "pc" ||
+      !previewImageList ||
+      previewImageList.length == 0
+    )
+      return;
     if (isWeixinBrowser()) {
       this.controls.wxCtrl.setPreviewData(url, previewImageList);
     } else {

+ 10 - 5
src/modules/editor/module/stores/index.ts

@@ -32,13 +32,14 @@ export const store = EditorModule.store({
     isDisplay(state) {
       return state.mode === "display";
     },
-    
-    previewImageList(state) {
+
+    previewImageList() {
       const res: string[] = [];
       let scope = this;
       function deepChild(item: any) {
         if (typeof item == "string") {
           const comp = scope.controls.pageCtrl.compMap[item];
+          if (!comp) return;
           if (comp.compKey === "Image") {
             res.push(comp.value.url);
           } else if (comp.children) {
@@ -50,9 +51,13 @@ export const store = EditorModule.store({
               deepChild(d);
             });
           } else {
-            Object.values(item).forEach((d) => {
-              deepChild(d);
-            });
+            if (item.__rx == undefined) {
+              Object.values(item).forEach((d) => {
+                deepChild(d);
+              });
+            } else {
+              deepChild(item.default);
+            }
           }
         }
       }