diff --git a/index.html b/index.html
index f3e837a..80121e9 100644
--- a/index.html
+++ b/index.html
@@ -2,7 +2,7 @@
-
+
Wardrobe
diff --git a/src/App.tsx b/src/App.tsx
index 4a47f2f..f9b4133 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -39,7 +39,7 @@ function RootGate() {
const effective = user ?? getStoredUser();
return ;
}
- return ;
+ return
;
}
function RouterGate() {
@@ -65,7 +65,7 @@ function RouterGate() {
return (
} />
- } />
+ } />
}>
} />
} />
diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx
index 816e0b0..b8e5123 100644
--- a/src/components/Layout.tsx
+++ b/src/components/Layout.tsx
@@ -1,3 +1,4 @@
+import { useEffect, useRef } from "react";
import { Outlet, useNavigate, useLocation } from "react-router-dom";
import { useAppStore } from "../stores/app";
@@ -12,6 +13,12 @@ export default function Layout() {
const navigate = useNavigate();
const location = useLocation();
const user = useAppStore((s) => s.user);
+ const contentRef = useRef(null);
+
+ // 切换页面时回到顶部 + 触发过渡动画 (key 随路径重挂载)
+ useEffect(() => {
+ contentRef.current?.scrollTo({ top: 0 });
+ }, [location.pathname]);
const isActive = (path: string) =>
path === "/home" ? location.pathname === "/home" || location.pathname === "/" : location.pathname.startsWith(path);
@@ -23,8 +30,10 @@ export default function Layout() {
return (
-
-
+