diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-12 05:21:08 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-12 05:21:08 +0900 |
| commit | 3f749c6540650c634974a88048af4aa0657dc4e8 (patch) | |
| tree | 0fee66129d8b906027fbb520283171ae1685c63a /src/client | |
| parent | Update sequential-entrance.vue (diff) | |
| download | sharkey-3f749c6540650c634974a88048af4aa0657dc4e8.tar.gz sharkey-3f749c6540650c634974a88048af4aa0657dc4e8.tar.bz2 sharkey-3f749c6540650c634974a88048af4aa0657dc4e8.zip | |
良い感じに
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/router.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/client/router.ts b/src/client/router.ts index 0f80e736e1..a8b74b2eaf 100644 --- a/src/client/router.ts +++ b/src/client/router.ts @@ -62,11 +62,16 @@ export const router = new VueRouter({ ], // なんかHacky // 通常の使い方をすると scroll メソッドの behavior を設定できないため、自前で window.scroll するようにする - // setTimeout しないと、アニメーション(トランジション)の関係でうまく動かない scrollBehavior(to) { window._scroll = () => { // さらにHacky if (to.name === 'index') { window.scroll({ top: indexScrollPos, behavior: 'instant' }); + const i = setInterval(() => { + window.scroll({ top: indexScrollPos, behavior: 'instant' }); + }, 10); + setTimeout(() => { + clearInterval(i); + }, 500); } else { window.scroll({ top: 0, behavior: 'instant' }); } |