fix: 移动端刷新页面后主题回退的问题

在 index.html 添加内联 script,Vue 启动前从 localStorage 读取主题
并设置 data-theme 属性,消除 Pinia store 初始化时序导致的闪烁

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-12 20:32:31 +08:00
parent 1e0f77d4e6
commit 6c76b34d1b
+8
View File
@@ -6,6 +6,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>企迹 - 政企周报管理系统</title>
<!-- Apply saved theme before page render to prevent flash -->
<script>
(function() {
var theme = localStorage.getItem('theme') || 'editorial';
document.documentElement.setAttribute('data-theme', theme);
})();
</script>
<!-- Preconnect to Google Fonts origins for faster font loading -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>