From b693666caeb1e6fd3291faca2518bf6d6be2e895 Mon Sep 17 00:00:00 2001 From: sendevia Date: Tue, 9 Dec 2025 14:37:31 +0800 Subject: [PATCH] feat: initialize screen width store in components and refactor store logic --- .vitepress/theme/components/AppBar.vue | 2 + .vitepress/theme/components/NavBar.vue | 23 +++--- .vitepress/theme/components/PageIndicator.vue | 2 + .vitepress/theme/stores/screenWidth.ts | 70 +++++++++---------- 4 files changed, 45 insertions(+), 52 deletions(-) diff --git a/.vitepress/theme/components/AppBar.vue b/.vitepress/theme/components/AppBar.vue index 3f35e31..4ccf82b 100644 --- a/.vitepress/theme/components/AppBar.vue +++ b/.vitepress/theme/components/AppBar.vue @@ -130,6 +130,8 @@ const handleKeydown = (event: KeyboardEvent) => { }; onMounted(() => { + screenWidthStore.init(); + document.addEventListener("click", handleDocumentClick); document.addEventListener("keydown", handleKeydown); }); diff --git a/.vitepress/theme/components/NavBar.vue b/.vitepress/theme/components/NavBar.vue index 2281354..1aae076 100644 --- a/.vitepress/theme/components/NavBar.vue +++ b/.vitepress/theme/components/NavBar.vue @@ -1,5 +1,5 @@