Fixed scroll behaviour
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2019-10-20 21:40:44 +02:00
parent 0af1deaa00
commit 7419f2a3fb
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 16 additions and 0 deletions

View File

@ -27,6 +27,22 @@ Vue.use(Router)
export default new Router({
mode: 'history',
scrollBehavior (to, from, savedPosition) {
// If the user is using their forward/backward keys to navigate, we want to restore the scroll view
if(savedPosition) {
return savedPosition
}
// Scroll to anchor should still work
if(to.hash) {
return {
selector: to.hash
}
}
// Otherwise just scroll to the top
return { x: 0, y: 0 }
},
routes: [
{
path: '/',