diff --git a/js/theme.js b/js/theme.js index b205a3c..48c9209 100644 --- a/js/theme.js +++ b/js/theme.js @@ -38,4 +38,9 @@ function applyTheme() { const theme = getTheme(); document.documentElement.setAttribute('data-theme', theme); updateThemeUI(theme); -} \ No newline at end of file +} + +// 确保 DOM 加载完成后执行 +document.addEventListener('DOMContentLoaded', function() { + applyTheme(); +});