From b97a58d790354297fbee5e032e51c81f52d2d1b2 Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Thu, 19 May 2022 17:40:21 +0200 Subject: [PATCH 1/2] made scrolling not suck --- src/router/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/router/index.js b/src/router/index.js index 929f72ae..1b63fee0 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -108,6 +108,13 @@ const oldroutes = [ const router = createRouter({ history: createWebHashHistory(), routes, + scrollBehavior (to, from, savedPosition) { + if (savedPosition) { + return savedPosition + } else { + return { top: 0, behavior: 'smooth'} + } + }, }) export default router From 36954906b59f0ca339a928e59fc1646e86b48670 Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Fri, 20 May 2022 09:58:26 +0200 Subject: [PATCH 2/2] fixed scrolling in firefox https://github.com/vuejs/router/issues/1411 --- src/router/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index 1b63fee0..fe1a12fc 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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'} } },