diff --git a/components/common/CommonRouteTabs.vue b/components/common/CommonRouteTabs.vue index 75ca06e6..dc2850e5 100644 --- a/components/common/CommonRouteTabs.vue +++ b/components/common/CommonRouteTabs.vue @@ -15,6 +15,7 @@ const { options, command, replace, preventScrollTop = false } = $defineProps<{ }>() const router = useRouter() +const nuxtApp = useNuxtApp() useCommands(() => command ? options.map(tab => ({ @@ -24,7 +25,15 @@ useCommands(() => command icon: tab.icon ?? 'i-ri:file-list-2-line', onActivate: () => router.replace(tab.to), })) - : []) + : [], +) + +const handleClick = (to: RouteLocationRaw) => { + if (preventScrollTop || nuxtApp.$preventScrollToTop(router.resolve(to).fullPath)) + return + + nuxtApp.$scrollToTop() +}