Fix: 修正重定向逻辑 & 使用Pinia管理状态

This commit is contained in:
2025-07-16 15:51:34 +08:00
parent bdb02fd147
commit 9720bf05c6
6 changed files with 110 additions and 10 deletions

View File

@ -159,11 +159,22 @@
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { navigationConfig } from '@/config/navigation'
import { useNavigationStore } from '@/stores/navigation'
import { useRoute } from 'vue-router'
const { t, locale } = useI18n()
const route = useRoute()
const navigationStore = useNavigationStore()
const drawer = computed({
get: () => navigationStore.drawer,
set: (value: boolean) => {
navigationStore.setDrawerOpen(value)
},
})
const selectedIndex = computed(() => navigationStore.selectedIndex)
const drawer = ref(true)
const selectedIndex = ref(0)
const windowWidth = ref(typeof window === 'undefined' ? 1200 : window.innerWidth)
const showAboutDialog = ref(false)
@ -260,7 +271,6 @@
}
function handleSelect (index: number) {
selectedIndex.value = index
drawer.value = false // 选择后自动关闭抽屉
}