修复中控

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 {
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) {
+1 -1
View File
@@ -120,6 +120,6 @@
</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>
</html>