Kaynağa Gözat

修复card不能剧中的bug

liwei 1 yıl önce
ebeveyn
işleme
1d006a28bb

+ 2 - 0
src/modules/editor/components/CompUI/basicUI/Container/component.tsx

@@ -12,6 +12,7 @@ export const Component = defineComponent({
   props: {
     compId: string().isRequired,
     showMask: bool().def(false),
+    meta: bool().def(true),
   },
   setup(props) {
     const { helper, controls, store } = useEditor();
@@ -72,6 +73,7 @@ export const Component = defineComponent({
             compId={props.compId}
             style={containerScale}
             showMask={props.showMask}
+            meta={props.meta}
           >
             {comp.children.default?.map((compId, index) => {
               const compItem = helper.findComp(compId) as DesignComp;

+ 2 - 1
src/modules/editor/components/CompUI/basicUI/View.tsx

@@ -21,11 +21,12 @@ export const View = defineComponent({
     compId: string().isRequired,
     editlayer: bool().def(true),
     showMask: bool().def(false),
+    meta: bool().def(true),
   },
   emits: ["dblclick", "click"],
   setup(props, { slots, emit, attrs }) {
     const { store, actions, helper, controls } = useEditor();
-    const compRef = useCompRef(props.compId);
+    const compRef = useCompRef(props.compId, props.meta);
     const editorLayerRef = props.editlayer
       ? useCompEditLayerRef(props.compId)
       : ref();

+ 2 - 2
src/modules/editor/components/CompUI/basicUI/hooks.ts

@@ -1,7 +1,7 @@
 import { useEditor } from "@/modules/editor";
 import { inject, onMounted, provide, ref } from "vue";
 
-export function useCompRef(compId: string) {
+export function useCompRef(compId: string, writeMetaData = true) {
   const compRef = ref();
   const { store, helper, controls } = useEditor();
 
@@ -13,7 +13,7 @@ export function useCompRef(compId: string) {
 
   onMounted(() => {
     const comp = helper.findComp(compId);
-    if (comp) {
+    if (comp && writeMetaData) {
       Object.defineProperties(comp, {
         $el: {
           value: compRef.value,

+ 1 - 0
src/modules/editor/components/Viewport/Content/index.tsx

@@ -110,6 +110,7 @@ export default defineUI({
                         <div class="pointer-events-none">
                           <Comp
                             compId={c.id}
+                            meta={false}
                             style={{
                               transformOrigin: "0 0",
                               pointerEvent: "none",