From a084c272b9a7d7221ac39fbdf09b32751bba96ed Mon Sep 17 00:00:00 2001 From: dekun Date: Sat, 30 May 2026 12:26:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AD=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manual_trading_hub/static/app.js | 18 +++++------------- manual_trading_hub/static/index.html | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/manual_trading_hub/static/app.js b/manual_trading_hub/static/app.js index 943c418..28f61ab 100644 --- a/manual_trading_hub/static/app.js +++ b/manual_trading_hub/static/app.js @@ -29,18 +29,10 @@ } } - function delegateInstanceToParent(url, title, exchangeId, nextPath) { + /** 在 LocalNav 等父页 iframe 内:直接替换本 iframe 地址,避免 postMessage / 三层嵌套 */ + function openInstanceInParentFrame(url) { try { - window.parent.postMessage( - { - type: "hub:open-instance", - url, - title: title || "实例", - exchangeId: String(exchangeId), - nextPath: nextPath || "/", - }, - "*" - ); + window.location.assign(url); return true; } catch (_) { return false; @@ -71,8 +63,8 @@ const row = lastMonitorRows.find((x) => String(x.id) === String(exchangeId)); const title = row ? row.name : exchangeId; instanceFrameCtx = { exchangeId: String(exchangeId), nextPath: next, title }; - if (isHubEmbedded() && delegateInstanceToParent(url, title, exchangeId, next)) { - return; + if (isHubEmbedded()) { + if (openInstanceInParentFrame(url)) return; } openInstanceFrame(url, title); } catch (e) { diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index dbbf05b..b38f45b 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -120,6 +120,6 @@
- +