From bc91df5b01e46fef40162d88d39a98114e42c81d Mon Sep 17 00:00:00 2001 From: "gary.fu" Date: Wed, 3 Jul 2024 17:48:03 +0800 Subject: [PATCH] =?UTF-8?q?tab=E6=A8=A1=E5=BC=8F=E5=9C=A8production?= =?UTF-8?q?=E4=B8=8B=E5=88=87=E6=8D=A2=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/utils/index.js | 2 +- src/stores/TabsViewStore.js | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/utils/index.js b/src/components/utils/index.js index 49d3a4c..623958e 100644 --- a/src/components/utils/index.js +++ b/src/components/utils/index.js @@ -30,7 +30,7 @@ const calcWithIf = menuItem => { */ export const useInputType = (option) => { 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 `el-${option.type || 'input'}` diff --git a/src/stores/TabsViewStore.js b/src/stores/TabsViewStore.js index dd436d0..2a5506d 100644 --- a/src/stores/TabsViewStore.js +++ b/src/stores/TabsViewStore.js @@ -6,6 +6,25 @@ import { } from '@/route/RouteUtils' 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 * @property {boolean} isTabMode 是否开启tab模式 @@ -208,5 +227,5 @@ export const useTabsViewStore = defineStore('tabsView', () => { hasCloseDropdown } }, { - persist: true + persist: { serializer } })