Skip to content

Commit 3695490

Browse files
committed
fixed scrolling in firefox vuejs/router#1411
1 parent 8eca068 commit 3695490

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/router/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,16 @@ const oldroutes = [
105105
{ path: '/relayers', component: Relayers },
106106
]
107107

108+
const delay = (t) => new Promise((r) => setTimeout(r, t))
109+
108110
const router = createRouter({
109111
history: createWebHashHistory(),
110112
routes,
111-
scrollBehavior (to, from, savedPosition) {
113+
async scrollBehavior (to, from, savedPosition) {
112114
if (savedPosition) {
113115
return savedPosition
114116
} else {
117+
await delay(0)
115118
return { top: 0, behavior: 'smooth'}
116119
}
117120
},

0 commit comments

Comments
 (0)