Fix scrollBehavior

This commit is contained in:
wvffle 2022-06-30 03:37:03 +00:00 committed by Georg Krause
parent d57932444b
commit dbe762d71c
1 changed files with 13 additions and 14 deletions

View File

@ -32,22 +32,21 @@ console.log('PROCESS', import.meta.env)
export default createRouter({ export default createRouter({
history: createWebHistory(import.meta.env.VUE_APP_ROUTER_BASE_URL as string ?? '/'), history: createWebHistory(import.meta.env.VUE_APP_ROUTER_BASE_URL as string ?? '/'),
linkActiveClass: 'active', linkActiveClass: 'active',
// TODO (wvffle): uncomment scrollBehavior (to, from, savedPosition) {
// scrollBehavior (to, from, savedPosition) { if (to.meta.preserveScrollPosition) {
// if (to.meta.preserveScrollPosition) { return savedPosition ?? { left: 0, top: 0 }
// return savedPosition ?? { left: 0, top: 0 } }
// }
// return new Promise(resolve => { return new Promise(resolve => {
// setTimeout(() => { setTimeout(() => {
// if (to.hash) { if (to.hash) {
// resolve({ el: to.hash, behavior: 'smooth' }) resolve({ el: to.hash, behavior: 'smooth' })
// } }
// resolve(savedPosition ?? { left: 0, top: 0 }) resolve(savedPosition ?? { left: 0, top: 0 })
// }, 100) }, 100)
// }) })
// }, },
routes: [ routes: [
{ {
path: '/', path: '/',