From 454c7fb8f372c6a1409cc9e5ed62a1957dbdfedc Mon Sep 17 00:00:00 2001 From: Tim <135014430+nagisa77@users.noreply.github.com> Date: Sun, 3 Aug 2025 00:33:34 +0800 Subject: [PATCH] Fix post scroller sync and top time --- open-isle-cli/src/views/PostPageView.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/open-isle-cli/src/views/PostPageView.vue b/open-isle-cli/src/views/PostPageView.vue index 311383bcf..d527320f8 100644 --- a/open-isle-cli/src/views/PostPageView.vue +++ b/open-isle-cli/src/views/PostPageView.vue @@ -89,7 +89,7 @@
loading...
-
{{ postTime }}
+
{{ scrollerTopTime }}
@@ -323,6 +323,12 @@ export default { const lastReplyTime = computed(() => comments.value.length ? comments.value[comments.value.length - 1].time : postTime.value ) + const firstReplyTime = computed(() => + comments.value.length ? comments.value[0].time : postTime.value + ) + const scrollerTopTime = computed(() => + commentSort.value === 'OLDEST' ? postTime.value : firstReplyTime.value + ) watch( () => comments.value.length, @@ -351,8 +357,10 @@ export default { } } - const onSliderInput = () => { - const target = postItems.value[currentIndex.value - 1] + const onSliderInput = (e) => { + const index = Number(e.target.value) + currentIndex.value = index + const target = postItems.value[index - 1] if (target && mainContainer.value) { const top = getTopRelativeTo(target, mainContainer.value) mainContainer.value.scrollTo({ top, behavior: 'instant' }) @@ -584,6 +592,7 @@ export default { tags, comments, postTime, + scrollerTopTime, lastReplyTime, postItems, mainContainer,