From 696ece1c5b4be4fb995ff4cdde99d8b24d9032a6 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 17 Mar 2025 16:40:29 +0700 Subject: [PATCH] fix: scroll not working --- src/pages/00_manual/ViewPage.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/00_manual/ViewPage.vue b/src/pages/00_manual/ViewPage.vue index 6973b6a5..1347efa0 100644 --- a/src/pages/00_manual/ViewPage.vue +++ b/src/pages/00_manual/ViewPage.vue @@ -25,13 +25,13 @@ const md = new MarkdownIt() .use(mditHighlight, { hljs }) .use(mditFigureWithPCaption, { figcaption: 'alt' }); +const wrapper = ref(); const category = ref(''); const page = ref(''); const content = ref(''); const contentParsed = ref>(); const active = ref(''); const toc = ref(true); -const ts = ref(Date.now()); onMounted(async () => { if (typeof ROUTE.params['category'] === 'string') { @@ -93,19 +93,23 @@ async function scrollTo(id: string) { await nextTick(() => { if (window.innerWidth < 1024) toc.value = false; }); - if (pos) - window.scrollTo({ + if (pos) { + wrapper.value?.scrollTo({ top: pos, behavior: 'smooth', }); + } }