From 2b118345ec79cd89a6ac0de8c412dc5172b868fc Mon Sep 17 00:00:00 2001 From: magisk317 <93979778+magisk317@users.noreply.github.com> Date: Mon, 17 Nov 2025 15:54:27 +0800 Subject: [PATCH 1/2] feat(logger): improve log viewer controls --- packages/components/client/virtual/list.vue | 7 +- plugins/logger/client/index.vue | 87 ++++++++++++++++++++- plugins/logger/client/logs.vue | 33 ++++++-- 3 files changed, 120 insertions(+), 7 deletions(-) diff --git a/packages/components/client/virtual/list.vue b/packages/components/client/virtual/list.vue index 4fc80995..ae87a78a 100644 --- a/packages/components/client/virtual/list.vue +++ b/packages/components/client/virtual/list.vue @@ -35,6 +35,7 @@ const props = defineProps({ activeKey: { default: '' }, threshold: { default: 0 }, maxHeight: String, + follow: { type: Boolean, default: true }, activate: { type: String as PropType<'top' | 'bottom' | 'current'>, default: 'bottom', @@ -47,7 +48,7 @@ const root = ref() watch(() => props.data.length, () => { const { scrollTop, clientHeight, scrollHeight } = root.value.wrapRef - if (!props.pinned || Math.abs(scrollTop + clientHeight - scrollHeight) < 1) { + if (props.follow && (!props.pinned || Math.abs(scrollTop + clientHeight - scrollHeight) < 1)) { nextTick(scrollToBottom) } virtual.updateUids(getUids()) @@ -93,6 +94,10 @@ onMounted(() => { } }) +watch(() => props.follow, (value) => { + if (value) nextTick(scrollToBottom) +}) + function scrollToOffset(offset: number, smooth = false) { if (smooth) { root.value.wrapRef.scrollTo({ top: offset, behavior: 'smooth' }) diff --git a/plugins/logger/client/index.vue b/plugins/logger/client/index.vue index de81d1d0..5b082114 100644 --- a/plugins/logger/client/index.vue +++ b/plugins/logger/client/index.vue @@ -1,12 +1,97 @@ + + diff --git a/plugins/logger/client/logs.vue b/plugins/logger/client/logs.vue index 38e13d97..a8a4343c 100644 --- a/plugins/logger/client/logs.vue +++ b/plugins/logger/client/logs.vue @@ -1,7 +1,14 @@