Skip to content

Commit

Permalink
fix(site): add router scrollBehavior (#2914)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Feb 4, 2024
1 parent 1bbaaed commit 42c4f29
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sites/mobile/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ routes.push({

const router = createRouter({
history: createWebHashHistory(),
scrollBehavior(to, from, savedPosition) {
// 始终滚动到顶部
if (savedPosition) {
return savedPosition;
} else {
return { top: 0 };
}
},
routes
});

Expand Down

0 comments on commit 42c4f29

Please sign in to comment.