From d4537b3b70375b022cd0a01fed63f26aeefa3b90 Mon Sep 17 00:00:00 2001 From: Kamil Niemczycki Date: Tue, 31 Aug 2021 19:01:46 +0200 Subject: [PATCH] Repair scrolling --- src/router/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index 8438aef..b084476 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -53,7 +53,19 @@ const routes = [ const router = new VueRouter({ mode: 'history', base: process.env.BASE_URL ?? '/', - routes + routes, + scrollBehavior (to, from, savedPosition) { + if (savedPosition) { + return savedPosition + } else if (to.hash) { + return { + selector: to.hash, + behavior: 'smooth' + } + } else { + return { x: 0, y: 0 } + } + } }) const title = ' :: ' + mainTitle