diff --git a/src/App.vue b/src/App.vue index 9eacb1a..7d50002 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,6 +12,14 @@ const isDarkMode = ref( window.matchMedia("(prefers-color-scheme: dark)").matches, ); +// Navbar显示状态管理 +const showNavbar = ref(true); + +// 切换Navbar显示状态 +const toggleNavbar = () => { + showNavbar.value = !showNavbar.value; +}; + // 初始化主题设置 onMounted(() => { // 应用初始主题 @@ -47,6 +55,12 @@ provide("theme", { toggleTheme, }); +// 提供Navbar控制给子组件 +provide("navbar", { + showNavbar, + toggleNavbar, +}); + const currentRoutePath = computed(() => { return router.currentRoute.value.path; }); @@ -56,8 +70,8 @@ useAlertProvider();