diff --git a/src/components/Tabs.vue b/src/components/Tabs.vue index 542be0b..86ff46d 100644 --- a/src/components/Tabs.vue +++ b/src/components/Tabs.vue @@ -104,15 +104,17 @@ const ejectModalVisible = ref(false) const handleModalVisible = () => { ejectModalVisible.value = false - changeTab(1) + tabStore.updateActiveTab(tabStore.preActiveTab) } const changeTab = index => { tabStore.updateActiveTab(index) if (index == 1) { router.push('/') + tabStore.updatePreActiveTab(1) } if (index == 2) { router.push('/test') + tabStore.updatePreActiveTab(2) } if (index == 3) { ejectModalVisible.value = true diff --git a/src/store/modules/tab.js b/src/store/modules/tab.js index c627a36..8dd81cc 100644 --- a/src/store/modules/tab.js +++ b/src/store/modules/tab.js @@ -7,10 +7,14 @@ export const useTabStore = defineStore({ return { activeStep: 1, activeTab: 1, + preActiveTab: 1, } }, // actions actions: { + updatePreActiveTab(preActiveTab) { + this.preActiveTab = preActiveTab + }, updateActiveStep(activeStep) { this.activeStep = activeStep },