修复中控

This commit is contained in:
dekun
2026-05-30 12:26:06 +08:00
parent 26004fb0e7
commit a084c272b9
2 changed files with 6 additions and 14 deletions
+5 -13
View File
@@ -29,18 +29,10 @@
} }
} }
function delegateInstanceToParent(url, title, exchangeId, nextPath) { /** 在 LocalNav 等父页 iframe 内:直接替换本 iframe 地址,避免 postMessage / 三层嵌套 */
function openInstanceInParentFrame(url) {
try { try {
window.parent.postMessage( window.location.assign(url);
{
type: "hub:open-instance",
url,
title: title || "实例",
exchangeId: String(exchangeId),
nextPath: nextPath || "/",
},
"*"
);
return true; return true;
} catch (_) { } catch (_) {
return false; return false;
@@ -71,8 +63,8 @@
const row = lastMonitorRows.find((x) => String(x.id) === String(exchangeId)); const row = lastMonitorRows.find((x) => String(x.id) === String(exchangeId));
const title = row ? row.name : exchangeId; const title = row ? row.name : exchangeId;
instanceFrameCtx = { exchangeId: String(exchangeId), nextPath: next, title }; instanceFrameCtx = { exchangeId: String(exchangeId), nextPath: next, title };
if (isHubEmbedded() && delegateInstanceToParent(url, title, exchangeId, next)) { if (isHubEmbedded()) {
return; if (openInstanceInParentFrame(url)) return;
} }
openInstanceFrame(url, title); openInstanceFrame(url, title);
} catch (e) { } catch (e) {
+1 -1
View File
@@ -120,6 +120,6 @@
</div> </div>
<div id="toast"></div> <div id="toast"></div>
<script src="/assets/app.js?v=20260530-hub-nav-delegate"></script> <script src="/assets/app.js?v=20260530-hub-embed-nav"></script>
</body> </body>
</html> </html>