From 62decae014af1b669e3523730bb7fb8afdfcf1a2 Mon Sep 17 00:00:00 2001 From: Vasilii Mikhailovskii Date: Tue, 26 Nov 2024 21:00:52 +0200 Subject: [PATCH] add router scrollBehavior --- apps/frontend/src/router/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/frontend/src/router/index.ts b/apps/frontend/src/router/index.ts index cd39293..c7a55e1 100644 --- a/apps/frontend/src/router/index.ts +++ b/apps/frontend/src/router/index.ts @@ -93,6 +93,13 @@ const routes = [ const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes, + scrollBehavior(to, from, savedPosition) { + if (savedPosition) { + return savedPosition + } else { + return { top: 0, behavior: 'smooth' } + } + }, }) export default router