diff --git a/src/components/ThemeToggle.astro b/src/components/ThemeToggle.astro index 7b16334..a2da222 100644 --- a/src/components/ThemeToggle.astro +++ b/src/components/ThemeToggle.astro @@ -4,9 +4,9 @@ interface Props { width?: number; fill?: string; className?: string; - // 更新主题过渡动画模式配置 + // 过渡动画模式配置 transitionMode?: "expand" | "shrink" | "auto" | "reverse-auto"; - // 新增自定义主题切换动画时间 + // 自定义主题切换动画时间 transitionDuration?: number; } @@ -66,950 +66,544 @@ import "../styles/theme-toggle.css"; \ No newline at end of file diff --git a/src/scripts/swup-init.js b/src/scripts/swup-init.js index 16df6d3..7cf125d 100644 --- a/src/scripts/swup-init.js +++ b/src/scripts/swup-init.js @@ -111,7 +111,12 @@ document.addEventListener('DOMContentLoaded', () => { swup.use(preloadPlugin); // 创建并注册Head插件,用于解决CSS丢失问题 - const headPlugin = new SwupHeadPlugin(); + const headPlugin = new SwupHeadPlugin({ + persistTags: 'link[rel="stylesheet"], style, meta', // 保留所有样式表和相关标签 + persistAssets: true, // 保留已加载的资源 + keepScrollOnReload: true, // 保持滚动位置 + awaitAssets: true // 等待资源加载完成再显示页面 + }); swup.use(headPlugin); // 添加Scripts插件 - 确保页面转场后脚本能重新执行