Fix scrollBehavior
This commit is contained in:
parent
d57932444b
commit
dbe762d71c
|
@ -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: '/',
|
||||||
|
|
Loading…
Reference in New Issue