Browse Source

modal tab

master
maochaoying 2 years ago
parent
commit
db2fdf817d
  1. 4
      src/components/Tabs.vue
  2. 4
      src/store/modules/tab.js

4
src/components/Tabs.vue

@ -104,15 +104,17 @@ const ejectModalVisible = ref(false)
const handleModalVisible = () => { const handleModalVisible = () => {
ejectModalVisible.value = false ejectModalVisible.value = false
changeTab(1)
tabStore.updateActiveTab(tabStore.preActiveTab)
} }
const changeTab = index => { const changeTab = index => {
tabStore.updateActiveTab(index) tabStore.updateActiveTab(index)
if (index == 1) { if (index == 1) {
router.push('/') router.push('/')
tabStore.updatePreActiveTab(1)
} }
if (index == 2) { if (index == 2) {
router.push('/test') router.push('/test')
tabStore.updatePreActiveTab(2)
} }
if (index == 3) { if (index == 3) {
ejectModalVisible.value = true ejectModalVisible.value = true

4
src/store/modules/tab.js

@ -7,10 +7,14 @@ export const useTabStore = defineStore({
return { return {
activeStep: 1, activeStep: 1,
activeTab: 1, activeTab: 1,
preActiveTab: 1,
} }
}, },
// actions // actions
actions: { actions: {
updatePreActiveTab(preActiveTab) {
this.preActiveTab = preActiveTab
},
updateActiveStep(activeStep) { updateActiveStep(activeStep) {
this.activeStep = activeStep this.activeStep = activeStep
}, },

Loading…
Cancel
Save