From 3035c3cee4c439e82c82f4d85b847aa7b56e1711 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Fri, 11 Feb 2022 02:57:11 +0000 Subject: [PATCH] Revert "Remove unnecessary scrollBehavior function in router." This reverts commit 275ccbc54722a891da948486e2289c720fb7a951. --- src/router/router.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/router/router.js b/src/router/router.js index bc550e3f..085f0f93 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -75,6 +75,9 @@ const routes = [ const router = createRouter({ history: createWebHistory(), routes, + scrollBehavior: function (_to, _from, savedPosition) { + return savedPosition ? savedPosition : window.scrollTo(0, 0); + }, }); export default router;