fix: scroll to hash

This commit is contained in:
skytek_xinliang
2026-09-23 17:51:35 +08:00
parent 92c5163334
commit 0727a803c0
5 changed files with 28 additions and 5 deletions
+9 -1
View File
@@ -20,7 +20,15 @@ import { getApiErrorStatus } from "@/utils/api-error";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
scrollBehavior() {
scrollBehavior(to, _from, savedPosition) {
if (savedPosition) {
return savedPosition;
}
if (to.hash) {
return { el: to.hash, top: 68 };
}
return { left: 0, top: 0 };
},
routes: [