fix(frontend): ページ遷移でスクロール位置が保持されない問題を修正

Fix #11068
This commit is contained in:
syuilo
2023-07-08 15:30:36 +09:00
parent 644023316e
commit 15683370f0
6 changed files with 53 additions and 47 deletions

View File

@@ -7,24 +7,29 @@
</template>
</template>
<RouterView @contextmenu.stop="onContextmenu"/>
<div ref="contents">
<RouterView @contextmenu.stop="onContextmenu"/>
</div>
</XColumn>
</template>
<script lang="ts" setup>
import { ComputedRef, provide } from 'vue';
import { ComputedRef, provide, shallowRef } from 'vue';
import XColumn from './column.vue';
import { deckStore, Column } from '@/ui/deck/deck-store';
import * as os from '@/os';
import { i18n } from '@/i18n';
import { mainRouter } from '@/router';
import { PageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata';
import { useScrollPositionManager } from '@/nirax';
import { getScrollContainer } from '@/scripts/scroll';
defineProps<{
column: Column;
isStacked: boolean;
}>();
const contents = shallowRef<HTMLElement>();
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
provide('router', mainRouter);
@@ -61,4 +66,6 @@ function onContextmenu(ev: MouseEvent) {
},
}], ev);
}
useScrollPositionManager(() => getScrollContainer(contents.value), mainRouter);
</script>