liwei hai 1 ano
pai
achega
09f94ddd1d

+ 3 - 2
src/modules/editor/components/Canvas/index.tsx

@@ -1,5 +1,6 @@
 import { defineUI } from "queenjs";
 import { useEditor } from "../..";
+import ErrorComp from "../CompUI/placeHoder";
 
 export default defineUI({
   setup() {
@@ -7,8 +8,8 @@ export default defineUI({
     return () => (
       <div>
         {store.designData.content.map((d) => {
-          const Comp: any = config.compUI[d.compKey].Component;
-          return <Comp key={d.id} compId={d.id} />;
+          const Comp: any = config.compUI[d.compKey]?.Component;
+          return Comp && <Comp key={d.id} compId={d.id} />;
         })}
       </div>
     );

+ 7 - 0
src/modules/editor/components/CompUI/placeHoder.tsx

@@ -0,0 +1,7 @@
+import { defineComponent } from "vue";
+
+export default defineComponent({
+     setup() {
+        return ()=><div>组件已被删除</div>
+     }
+})

+ 4 - 3
src/modules/editor/components/Viewport/Content/index.tsx

@@ -5,6 +5,7 @@ import { Container, Draggable } from "vue-dndrop";
 import { useEditor } from "../../..";
 import { HotKeyCtrl } from "../../../controllers/HotKeyCtrl";
 import Canvas from "../../Canvas";
+import ErrorComp from "../../CompUI/placeHoder";
 
 export default defineUI({
   setup() {
@@ -26,12 +27,12 @@ export default defineUI({
             non-drag-area-selector={".drag-disable"}
           >
             {store.designData.content.map((d) => {
-              const Comp: any = config.compUI[d.compKey]?.Component;
-              return Comp ? (
+              const Comp: any = config.compUI[d.compKey]?.Component || ErrorComp;
+              return (
                 <Draggable key={d.id}>
                   <Comp compId={d.id} />
                 </Draggable>
-              ) : undefined;
+              );
             })}
           </Container>
         ) : (