mirror of
https://github.com/fugary/simple-element-plus-template.git
synced 2025-11-12 14:27:49 +00:00
tab模式在production下切换失效问题
This commit is contained in:
@@ -30,7 +30,7 @@ const calcWithIf = menuItem => {
|
|||||||
*/
|
*/
|
||||||
export const useInputType = (option) => {
|
export const useInputType = (option) => {
|
||||||
const inType = option.type || 'input'
|
const inType = option.type || 'input'
|
||||||
if (inType.startsWith('common-') || inType.startsWith('el-')) {
|
if (inType.startsWith('common-') || inType.startsWith('el-') || inType.startsWith('vue-')) {
|
||||||
return inType // 控件全名
|
return inType // 控件全名
|
||||||
}
|
}
|
||||||
return `el-${option.type || 'input'}`
|
return `el-${option.type || 'input'}`
|
||||||
|
|||||||
@@ -6,6 +6,25 @@ import {
|
|||||||
} from '@/route/RouteUtils'
|
} from '@/route/RouteUtils'
|
||||||
import { TAB_MODE_MAX_CACHES } from '@/config'
|
import { TAB_MODE_MAX_CACHES } from '@/config'
|
||||||
|
|
||||||
|
const pureTab = tab => {
|
||||||
|
if (tab) {
|
||||||
|
return {
|
||||||
|
...tab,
|
||||||
|
matched: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const serializer = {
|
||||||
|
serialize (state) {
|
||||||
|
const newState = { ...state }
|
||||||
|
newState.historyTabs = state.historyTabs?.map(pureTab)
|
||||||
|
newState.currentTabItem = pureTab(state.currentTabItem)
|
||||||
|
return JSON.stringify(newState)
|
||||||
|
},
|
||||||
|
deserialize: JSON.parse
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} TabsViewStore
|
* @typedef {Object} TabsViewStore
|
||||||
* @property {boolean} isTabMode 是否开启tab模式
|
* @property {boolean} isTabMode 是否开启tab模式
|
||||||
@@ -208,5 +227,5 @@ export const useTabsViewStore = defineStore('tabsView', () => {
|
|||||||
hasCloseDropdown
|
hasCloseDropdown
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
persist: true
|
persist: { serializer }
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user