From 5a2eaee704477d60465bb426fe1a21a55f84101b Mon Sep 17 00:00:00 2001 From: suricata Date: Tue, 3 Feb 2026 01:56:06 +0000 Subject: [PATCH] using useScroll(div), not window --- app/layouts/dashboard.vue | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/layouts/dashboard.vue b/app/layouts/dashboard.vue index 76e0a45..a3c0337 100644 --- a/app/layouts/dashboard.vue +++ b/app/layouts/dashboard.vue @@ -49,15 +49,29 @@ const nav : NavigationMenuItem[][] = [[ onMounted(() => { ui_color_cookie(); }) +// pass the x and y of the container +const { x, y } = useScroll(useTemplateRef("layout_root_wrap")) + +// onMounted makes sure the page is loaded, window and document exists +onMounted(() => { + const Ystate = useState("root_y", () => 0); +// create a global state with the div's Y. +// I can't use window Y due to dashboard. +// So I need to do this way +watch(y, (newY) => { + Ystate.value = newY; +}) +}) +