mirror of
https://github.com/OpenBMB/ChatDev.git
synced 2026-04-25 11:18:06 +00:00
Merge pull request #580 from NINE-J/style/sidebar-scroll-behavior
fix: Fix what the navigation hide interaction affects all pages
This commit is contained in:
commit
75e889decf
@ -61,13 +61,21 @@ const handleScroll = (e) => {
|
|||||||
lastScrollY = currentScrollY <= 0 ? 0 : currentScrollY;
|
lastScrollY = currentScrollY <= 0 ? 0 : currentScrollY;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
const toggleScrollListener = (shouldListen) => {
|
||||||
// Listen to scroll events during the capture phase to track child scrolling (like TutorialView)
|
if (shouldListen) {
|
||||||
window.addEventListener('scroll', handleScroll, true);
|
window.addEventListener('scroll', handleScroll, true);
|
||||||
})
|
} else {
|
||||||
|
window.removeEventListener('scroll', handleScroll, true);
|
||||||
|
isHidden.value = false; // Reset state when leaving
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => route.path, () => {
|
||||||
|
toggleScrollListener(!!route.meta.hideNavOnScroll);
|
||||||
|
}, { immediate: true }) // immediate: true runs this once on mount
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener('scroll', handleScroll, true);
|
toggleScrollListener(false);
|
||||||
document.body.classList.remove('nav-hidden');
|
document.body.classList.remove('nav-hidden');
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -7,7 +7,8 @@ const routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/tutorial',
|
path: '/tutorial',
|
||||||
component: () => import('../pages/TutorialView.vue')
|
component: () => import('../pages/TutorialView.vue'),
|
||||||
|
meta: { hideNavOnScroll: true }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/launch',
|
path: '/launch',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user