diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-06 18:25:25 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-06 18:25:25 +0900 |
| commit | 0e29e864c8f2299755323c564ddfb4c9b7f4b492 (patch) | |
| tree | b1e6d17a9332f78ae84b8f353553e1905e23c376 /src/client | |
| parent | Fix i18n (diff) | |
| download | misskey-0e29e864c8f2299755323c564ddfb4c9b7f4b492.tar.gz misskey-0e29e864c8f2299755323c564ddfb4c9b7f4b492.tar.bz2 misskey-0e29e864c8f2299755323c564ddfb4c9b7f4b492.zip | |
Refactor
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/app.vue | 6 | ||||
| -rw-r--r-- | src/client/router.ts | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/client/app.vue b/src/client/app.vue index 4e89aa4351..d515ac02d3 100644 --- a/src/client/app.vue +++ b/src/client/app.vue @@ -76,7 +76,7 @@ <div class="contents"> <main ref="main"> <div class="content"> - <transition name="page" mode="out-in"> + <transition name="page" mode="out-in" @enter="onTransition"> <keep-alive :include="['index']"> <router-view></router-view> </keep-alive> @@ -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 5ab4fa0cb6..82451260c3 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; + }; } }); |