瀏覽代碼

修改需求

bill 2 年之前
父節點
當前提交
a023f70ff8
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      src/model/app.vue

+ 7 - 2
src/model/app.vue

@@ -47,6 +47,7 @@ export const Model = defineComponent({
       if (urls[type] !== url.value) {
         setTimeout(() => {
           const hook = (iframeRef.value?.contentWindow as any)?.beforeDestroy
+          console.log(hook)
           if (hook) {
             hook()
             setTimeout(() => url.value = urls[type], 300)
@@ -58,12 +59,16 @@ export const Model = defineComponent({
     })
 
 
+
     const fuseRef = ref<HTMLDivElement>()
     const iframeRef = ref<HTMLIFrameElement>()
 
     watch(
-      () => modelProps.type, 
-      async (type, oldType, onCleanup) => {
+      () => [modelProps.type, url.value],
+      async ([type, url], oldType, onCleanup) => {
+        if (type !== fuseModel && !url) {
+          return;
+        }
         const callback = modelProps.callback
 
         await nextTick()