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