From 7853605e70ebdb379f894a903bbf09acfe9485fc Mon Sep 17 00:00:00 2001 From: Graham Smith <gsmith@skye.local> Date: Mon, 13 Jul 2020 13:56:33 -0400 Subject: [PATCH] reset scroll position --- 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 5bcfecff..e5754504 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -72,7 +72,19 @@ const routes = [ const router = new VueRouter({ base: process.env.BASE_URL, - routes + routes, + scrollBehavior(to, from, savedPosition) { + if (savedPosition) { + return savedPosition; + } + if (to.hash) { + return { + selector: to.hash + }; + } + + return { x: 0, y: 0 }; + } }); const vueBodyClass = new VueBodyClass(routes); -- GitLab