20260825173027

This commit is contained in:
oneao committed 2026-08-25 17:30:28 +08:00
1 parent 7421019ef2
commit a509f93f34
11 files changed
+615 -934

No files matched your search

+6 -2
View File
@@ -248,15 +248,19 @@
<body>
<div id="app">
<script>
// 模块加载失败时(如直接 file:// 打开)展示错误,避免永远卡在加载屏
// 模块加载失败时(如直接 file:// 打开)展示错误,避免永远卡在加载屏。
// 忽略良性噪音错误(ResizeObserver 循环等浏览器警告也会走 error 事件),
// 否则 DevTools 展开/收起等触发 resize 时会把整个页面误替换成错误页。
window.addEventListener('error', (e) => {
const msg = e && e.message ? String(e.message) : ''
if (/ResizeObserver loop/i.test(msg)) return
const app = document.getElementById('app')
if (app) {
app.innerHTML =
'<div id="app-boot-error" class="app-boot app-boot--error" style="position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:12px;font-family:sans-serif">' +
'<div style="font-size:20px;font-weight:bold">加载失败</div>' +
'<div style="font-size:14px">请通过本地开发服务器访问(如 npm run dev),不要直接以 file:// 方式打开本文件。</div>' +
(e && e.message ? '<div style="font-size:12px;opacity:.7">' + e.message + '</div>' : '') +
(msg ? '<div style="font-size:12px;opacity:.7">' + msg + '</div>' : '') +
'</div>'
}
})