Fixed scroll behaviour

This commit is contained in:
kolaente 2019-10-20 21:40:44 +02:00
parent 0af1deaa00
commit 7419f2a3fb
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

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: '/',