summaryrefslogtreecommitdiff
path: root/packages/client/src/router.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-06-29 16:00:00 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-06-29 16:00:00 +0900
commitbb68cfaa815ce4b33f0671710fd94f9d94f4324c (patch)
treef14fefc1dceeb81e991749e74a5f9eed2115192d /packages/client/src/router.ts
parentchore(client): tweak client (diff)
downloadmisskey-bb68cfaa815ce4b33f0671710fd94f9d94f4324c.tar.gz
misskey-bb68cfaa815ce4b33f0671710fd94f9d94f4324c.tar.bz2
misskey-bb68cfaa815ce4b33f0671710fd94f9d94f4324c.zip
enhance(client): improve router
Fix #8902
Diffstat (limited to '')
-rw-r--r--packages/client/src/router.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/client/src/router.ts b/packages/client/src/router.ts
index a452a8bb3d..d257612f35 100644
--- a/packages/client/src/router.ts
+++ b/packages/client/src/router.ts
@@ -50,6 +50,7 @@ export const routes = [{
}, {
path: '/about',
component: page(() => import('./pages/about.vue')),
+ hash: 'initialTab',
}, {
path: '/about-misskey',
component: page(() => import('./pages/about-misskey.vue')),
@@ -203,7 +204,7 @@ export const routes = [{
component: page(() => import('./pages/not-found.vue')),
}];
-export const mainRouter = new Router(routes, location.pathname + location.search);
+export const mainRouter = new Router(routes, location.pathname + location.search + location.hash);
window.history.replaceState({ key: mainRouter.getCurrentKey() }, '', location.href);
@@ -228,7 +229,7 @@ mainRouter.addListener('push', ctx => {
});
window.addEventListener('popstate', (event) => {
- mainRouter.change(location.pathname + location.search, event.state?.key);
+ mainRouter.change(location.pathname + location.search + location.hash, event.state?.key);
const scrollPos = scrollPosStore.get(event.state?.key) ?? 0;
window.scroll({ top: scrollPos, behavior: 'instant' });
window.setTimeout(() => { // 遷移直後はタイミングによってはコンポーネントが復元し切ってない可能性も考えられるため少し時間を空けて再度スクロール