diff --git a/src/router/index.js b/src/router/index.js index 5bcfecfff58635b1b89c94af164dafec46cf2c36..e5754504ef99d258f506420e91ce82d1d308b9c8 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);