Skip to content

Commit

Permalink
fixed scrolling in firefox vuejs/router#1411
Browse files Browse the repository at this point in the history
  • Loading branch information
lxgr-linux committed May 20, 2022
1 parent 8eca068 commit 3695490
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/router/index.js
Expand Up @@ -105,13 +105,16 @@ const oldroutes = [
{ path: '/relayers', component: Relayers },
]

const delay = (t) => new Promise((r) => setTimeout(r, t))

const router = createRouter({
history: createWebHashHistory(),
routes,
scrollBehavior (to, from, savedPosition) {
async scrollBehavior (to, from, savedPosition) {
if (savedPosition) {
return savedPosition
} else {
await delay(0)
return { top: 0, behavior: 'smooth'}
}
},
Expand Down

0 comments on commit 3695490

Please sign in to comment.