lesson 179: add scroll behaviour

This commit is contained in:
Andreas Zweili 2021-05-02 14:40:47 +02:00
parent 1b73f94b8d
commit 0117da813d
1 changed files with 9 additions and 1 deletions

View File

@ -26,7 +26,15 @@ const router = createRouter({
]
},
{ path: '/users', component: UsersList }
]
],
linkActiveClass: 'active',
scrollBehavior(to, from, savedPosition) {
console.log(to, from);
if (savedPosition) {
return savedPosition;
}
return { left: 0, top: 0 };
}
});
app.use(router);