From 80ec31fa92370472a442a43de993d7a6ce79741a Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 2 Jul 2023 15:55:57 +0100 Subject: fix: delay scrolling the Mods View to prevent it stopping prematurely (#403) --- src-vue/src/views/mods/ThunderstoreModsView.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src-vue/src/views/mods/ThunderstoreModsView.vue b/src-vue/src/views/mods/ThunderstoreModsView.vue index 7f70f03c..1221f85f 100644 --- a/src-vue/src/views/mods/ThunderstoreModsView.vue +++ b/src-vue/src/views/mods/ThunderstoreModsView.vue @@ -18,7 +18,7 @@ layout="prev, pager, next" :page-size="modsPerPage" :total="modsList.length" - @current-change="(e: number) => currentPageIndex = e - 1" + @update:current-page="onPaginationChange" /> @@ -36,7 +36,8 @@ layout="prev, pager, next" :page-size="modsPerPage" :total="modsList.length" - @current-change="onBottomPaginationChange" + @update:current-page="onPaginationChange" + @current-change="scrollTop" /> @@ -183,9 +184,13 @@ export default defineComponent({ /** * This updates current pagination and scrolls view to the top. */ - onBottomPaginationChange(index: number) { + onPaginationChange(index: number) { this.currentPageIndex = index - 1; - (this.$refs.scrollbar as ScrollbarInstance).scrollTo({ top: 0, behavior: 'smooth' }); + }, + scrollTop(index: number) { + setTimeout(() => { + (this.$refs.scrollbar as ScrollbarInstance).scrollTo({ top: 0, behavior: 'smooth' }); + }, 100) } }, watch: { -- cgit v1.2.3