diff --git a/src/layout/components/Tabs/index.vue b/src/layout/components/Tabs/index.vue index 723a895..ef529eb 100644 --- a/src/layout/components/Tabs/index.vue +++ b/src/layout/components/Tabs/index.vue @@ -79,7 +79,7 @@ watch( // 点击页签 const handleTabClick = (key: string) => { const obj = tabsStore.tabList.find((i) => i.path === key) - obj ? router.push(obj.fullPath) : router.push(key) + obj ? router.push(obj.fullPath || obj.path) : router.push(key) } diff --git a/src/stores/modules/tabs.ts b/src/stores/modules/tabs.ts index bbd7400..702f4d3 100644 --- a/src/stores/modules/tabs.ts +++ b/src/stores/modules/tabs.ts @@ -28,7 +28,8 @@ const storeSetup = () => { const isActive = router.currentRoute.value.path === tabList.value[index].path tabList.value.splice(index, 1) if (isActive) { - router.push(tabList.value[tabList.value.length - 1].fullPath) + const lastObj = tabList.value[tabList.value.length - 1] + router.push(lastObj.fullPath || lastObj.path) } }