20260817172952
This commit is contained in:
1 parent
4ef678ba65
commit
5bbd3c88b4
1865 files changed
+2261
-901
No files matched your search
@@ -17,4 +17,30 @@ app.use(router)
|
||||
// mount 前初始化主题同步(恢复持久化状态并写入 DOM,避免首屏闪烁)
|
||||
initThemeSync(pinia)
|
||||
|
||||
app.mount('#app')
|
||||
function showBootstrapError(error) {
|
||||
console.error('Application bootstrap failed', error)
|
||||
|
||||
const boot = document.querySelector('#app-boot')
|
||||
const message = document.querySelector('#app-boot-message')
|
||||
const retry = document.querySelector('#app-boot-retry')
|
||||
if (!boot || !message || !retry) return
|
||||
|
||||
boot.classList.add('app-boot--error')
|
||||
boot.setAttribute('aria-busy', 'false')
|
||||
boot.setAttribute('aria-label', '应用加载失败')
|
||||
message.textContent = '应用加载失败,请检查网络后重试'
|
||||
message.hidden = false
|
||||
retry.hidden = false
|
||||
retry.addEventListener('click', () => window.location.reload(), { once: true })
|
||||
}
|
||||
|
||||
async function bootstrap() {
|
||||
try {
|
||||
await router.isReady()
|
||||
app.mount('#app')
|
||||
} catch (error) {
|
||||
showBootstrapError(error)
|
||||
}
|
||||
}
|
||||
|
||||
void bootstrap()
|
||||
Reference in new issue
Block a user