Fix: 修正重定向逻辑 & 使用Pinia管理状态
This commit is contained in:
@ -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 // 选择后自动关闭抽屉
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user