perf: save to localStorage except cookie

This commit is contained in:
ibuler
2025-03-17 15:21:42 +08:00
committed by 老广
parent 7c72bcf84a
commit 155da5aecd
2 changed files with 10 additions and 7 deletions

View File

@@ -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)
}
})

View File

@@ -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
]