fix(ui): 首屏加载超时兜底 — 页面10s未挂载则提示重试,消除整页刷新偶发卡死(BUG-001) (cma-bug001-boot-timeout-20260912)

This commit is contained in:
Hermes CI Fix
2026-09-12 23:35:27 +08:00
parent b8f4a3d543
commit a145ab1da1
+12 -1
View File
@@ -24,10 +24,21 @@
<body> <body>
<div id="app"> <div id="app">
<!-- 加载时显示占位 --> <!-- 加载时显示占位 -->
<div style="display:flex;height:100%;align-items:center;justify-content:center;color:#999;font-size:14px"> <div id="boot-placeholder" style="display:flex;height:100%;align-items:center;justify-content:center;color:#999;font-size:14px">
加载中... 加载中...
</div> </div>
</div> </div>
<script>
// 首屏兜底(BUG-001):若 10s 内应用未挂载完成(chunk/首屏接口慢或失败),
// 提示重试,避免整页刷新后永久卡在"加载中"壳页。
// 挂载成功会替换 #app 内容,此定时器随之失效(getElementById 取不到即 no-op)。
setTimeout(function () {
var p = document.getElementById('boot-placeholder');
if (p) {
p.innerHTML = '页面加载超时,请 <a href="javascript:location.reload()" style="color:#409eff">点击重试</a>';
}
}, 10000);
</script>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
</body> </body>
</html> </html>