mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-25 18:56:37 +03:00
chore: allow scroll to top on nav side
This commit is contained in:
parent
f3a8778ede
commit
db2140e350
2 changed files with 5 additions and 4 deletions
|
@ -51,7 +51,7 @@ const noUserVisual = computed(() => isHydrated.value && props.userOnly && !curre
|
||||||
:active-class="activeClass"
|
:active-class="activeClass"
|
||||||
group focus:outline-none disabled:pointer-events-none
|
group focus:outline-none disabled:pointer-events-none
|
||||||
:tabindex="noUserDisable ? -1 : null"
|
:tabindex="noUserDisable ? -1 : null"
|
||||||
@click="$scrollToTop"
|
@click="$trackScroll.forceScrollToTop()"
|
||||||
>
|
>
|
||||||
<CommonTooltip :disabled="!isMediumOrLargeScreen" :content="text" placement="right">
|
<CommonTooltip :disabled="!isMediumOrLargeScreen" :content="text" placement="right">
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -28,18 +28,19 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||||
|
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (path !== route.fullPath) {
|
const fullPath = route.fullPath
|
||||||
|
if (path !== fullPath) {
|
||||||
reject(new Error('navigation canceled'))
|
reject(new Error('navigation canceled'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const r = ignoreCustomRoutes ? undefined : customRoutes.has(route.fullPath)
|
const r = ignoreCustomRoutes ? undefined : customRoutes.has(fullPath)
|
||||||
if (r) {
|
if (r) {
|
||||||
reject(new Error('custom routed detected'))
|
reject(new Error('custom routed detected'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollPosition = storage.value[route.fullPath]
|
const scrollPosition = storage.value[fullPath]
|
||||||
if (scrollPosition)
|
if (scrollPosition)
|
||||||
window.scrollTo(0, scrollPosition)
|
window.scrollTo(0, scrollPosition)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue