From db2140e35066244c376f6d77924b056eaea0c3cf Mon Sep 17 00:00:00 2001 From: userquin Date: Sat, 11 Feb 2023 15:42:37 +0100 Subject: [PATCH] chore: allow scroll to top on nav side --- components/nav/NavSideItem.vue | 2 +- plugins/track-scroll-position.client.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/nav/NavSideItem.vue b/components/nav/NavSideItem.vue index 6d323e17..5c0d222f 100644 --- a/components/nav/NavSideItem.vue +++ b/components/nav/NavSideItem.vue @@ -51,7 +51,7 @@ const noUserVisual = computed(() => isHydrated.value && props.userOnly && !curre :active-class="activeClass" group focus:outline-none disabled:pointer-events-none :tabindex="noUserDisable ? -1 : null" - @click="$scrollToTop" + @click="$trackScroll.forceScrollToTop()" >
{ return new Promise((resolve, reject) => { setTimeout(() => { - if (path !== route.fullPath) { + const fullPath = route.fullPath + if (path !== fullPath) { reject(new Error('navigation canceled')) return } - const r = ignoreCustomRoutes ? undefined : customRoutes.has(route.fullPath) + const r = ignoreCustomRoutes ? undefined : customRoutes.has(fullPath) if (r) { reject(new Error('custom routed detected')) return } - const scrollPosition = storage.value[route.fullPath] + const scrollPosition = storage.value[fullPath] if (scrollPosition) window.scrollTo(0, scrollPosition)