diff --git a/src/App.vue b/src/App.vue index 575a47f35f46c900e7a42c51d84c635ad5ee1e51..46439d73c66da38b75e8c2b033614a79667d42d3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,31 +3,6 @@ import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper'; import '@vue-flow/core/dist/style.css'; import '@vue-flow/core/dist/theme-default.css'; import DialogueView from 'src/views/dialogue/dialogueView.vue'; -import { watch } from 'vue'; -import { useRouter } from 'vue-router'; -const router = useRouter(); - -// 监听路由变化,控制iframe内容的活动状态 -watch( - () => router.currentRoute.value.path, - (newPath) => { - const iframe = document.getElementById('my-iframe'); - const isWitchaindRoute = newPath === '/witchainD'; - if (!iframe) { - console.warn('未找到iframe元素'); - return; - } - if (!iframe.contentWindow) { - console.warn('iframe.contentWindow不可用'); - return; - } - const message = { StopActive: !isWitchaindRoute }; - // 向iframe发送消息,控制其活动状态 StopActive为false表示激活,为true表示停止 - let target = `${window.location.origin}/witchaind`; - iframe.contentWindow.postMessage(message, target); - }, - { immediate: true } // 初始化时也执行 -);