diff --git a/src/guards.js b/src/guards.js index 9996e5ec3..3a7dcbc2e 100644 --- a/src/guards.js +++ b/src/guards.js @@ -6,20 +6,23 @@ import store from '@/store' import { isSameView } from '@/utils/jms' import { toSentenceCase } from '@/utils/common' -// NProgress.configure({ -// showSpinner: false -// }) // NProgress Configuration -// +function beforeRouteChange(to, from, next) { + localStorage.setItem('activeTab', '') +} + router.beforeEach(async(to, from, next) => { // start progress bar // NProgress.start() try { await store.dispatch('common/cleanDrawerActionMeta') await startup({ to, from, next }) + if (to.name !== from.name) { + await beforeRouteChange(to, from, next) + } next() } catch (e) { const msg = 'Start service error: ' + e - // debug(e) + console.log(msg) } }) diff --git a/src/layout/components/TabPage/index.vue b/src/layout/components/TabPage/index.vue index 89ff31cd8..a99c833d0 100644 --- a/src/layout/components/TabPage/index.vue +++ b/src/layout/components/TabPage/index.vue @@ -132,14 +132,14 @@ export default { handleTabClick(tab) { this.$emit('tab-click', tab) this.iActiveMenu = tab.name - this.$cookie.set('activeTab', tab.name, 1) + localStorage.setItem('activeTab', tab.name) }, getPropActiveTab() { let activeTab = '' const preActiveTabs = [ this.$route.query['tab'], - this.$cookie.get('activeTab'), + localStorage.getItem('activeTab'), this.activeMenu ]