升级到Nuxt4

 完成分类 标签的HTML搭建
🐛 修复ssg相关配置 之前错误的使用了SPA
🐛 修复部分ssg兼容问题
This commit is contained in:
li-chx
2025-09-26 18:09:05 +08:00
parent 75ba2bf5c8
commit 51a39d498b
14 changed files with 286 additions and 161 deletions
+5 -2
View File
@@ -1,10 +1,13 @@
const getInitialMode = () => {
function getInitialMode(): 'light' | 'dark' {
if (typeof window !== 'undefined') {
// 优先用 html 的 class
if (document.documentElement.classList.contains('dark')) return 'dark';
if (document.documentElement.classList.contains('light')) return 'light';
// 其次用 localStorage
return localStorage.getItem('system-theme-mode') || 'light';
const val = localStorage.getItem('system-theme-mode');
if (!!val || (val !== 'light' && val !== 'dark'))
return 'light';
return val;
}
return 'light'; // SSR 默认
};