From dfb48c90d9a4db69ec00740c15cd313b95470418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A8=9C?= Date: Wed, 12 Mar 2025 10:05:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=8E=AF=E5=A2=83=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=8D=E5=90=8C=E7=9A=84iframe=20src?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dialogue/dialogueView.vue | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/views/dialogue/dialogueView.vue b/src/views/dialogue/dialogueView.vue index f8845693..b5722ae9 100644 --- a/src/views/dialogue/dialogueView.vue +++ b/src/views/dialogue/dialogueView.vue @@ -229,6 +229,14 @@ onMounted(() => { } console.log('onMounted', window.location.host); initCopilot(); + const iframe = document.getElementById('my-iframe') as HTMLIFrameElement; + if (iframe) { + if(window.location.origin === 'http://localhost:3000'){ + iframe.src = `http://localhost:3002`; + }else{ + iframe.src = `${window.location.origin}/witchaind`; + } + } }); watch( @@ -286,14 +294,6 @@ watch( name: String(currRoute.value.query.name), }; } - - // 监听路由变化给iframe.src赋值 - if (currRoute.value.path === '/witchainD') { - const iframe = document.getElementById('my-iframe') as HTMLIFrameElement; - if(iframe){ - iframe.src = `${window.location.origin}/witchaind`; - } - } }, { deep: true, immediate: true }, ); @@ -428,8 +428,7 @@ watch( > - - +