diff --git a/src/client/app.vue b/src/client/app.vue index 4e89aa435..d515ac02d 100644 --- a/src/client/app.vue +++ b/src/client/app.vue @@ -76,7 +76,7 @@
- + @@ -258,6 +258,10 @@ export default Vue.extend({ if (this.canBack) window.history.back(); }, + onTransition() { + if (window._scroll) window._scroll(); + }, + post() { this.$root.post(); }, diff --git a/src/client/router.ts b/src/client/router.ts index 5ab4fa0cb..82451260c 100644 --- a/src/client/router.ts +++ b/src/client/router.ts @@ -56,13 +56,12 @@ export const router = new VueRouter({ // 通常の使い方をすると scroll メソッドの behavior を設定できないため、自前で window.scroll するようにする // setTimeout しないと、アニメーション(トランジション)の関係でうまく動かない scrollBehavior(to, from, savedPosition) { - setTimeout(() => { + window._scroll = () => { // さらにHacky if (savedPosition) { window.scroll({ top: savedPosition.y, behavior: 'instant' }); } else { window.scroll({ top: 0, behavior: 'instant' }); } - }, 600); - return; + }; } });