版本管理,优化
This commit is contained in:
@@ -28,6 +28,27 @@ export const useModuleTabsStore = defineStore('moduleTabs', () => {
|
||||
/** 是否显示浮动切换器(TabsList 滚出可视区时为 true) */
|
||||
const floatingVisible = ref<boolean>(false)
|
||||
|
||||
/** 待跳转 tab(搜索导航设置):{ moduleId, tab },模块挂载/已挂载时消费 */
|
||||
const pendingTab = ref<{ moduleId: string; tab: string } | null>(null)
|
||||
|
||||
/** 设置待跳转 tab(搜索结果点击时调用) */
|
||||
const setPendingTab = (moduleId: string, tab: string) => {
|
||||
pendingTab.value = { moduleId, tab }
|
||||
}
|
||||
|
||||
/**
|
||||
* 消费指定模块的待跳转 tab(返回 tab 值并清除)。
|
||||
* 仅在 moduleId 匹配时消费,避免误切当前已挂载模块的 tab。
|
||||
*/
|
||||
const consumePendingTab = (moduleId: string): string | null => {
|
||||
if (pendingTab.value && pendingTab.value.moduleId === moduleId) {
|
||||
const tab = pendingTab.value.tab
|
||||
pendingTab.value = null
|
||||
return tab
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/** 当前模块注册的保存处理函数(null 表示无保存按钮,如自动保存模块) */
|
||||
const saveHandler = ref<(() => unknown) | null>(null)
|
||||
/** 保存中状态(驱动按钮 disabled + loading 图标) */
|
||||
@@ -93,6 +114,7 @@ export const useModuleTabsStore = defineStore('moduleTabs', () => {
|
||||
tabs,
|
||||
activeTab,
|
||||
floatingVisible,
|
||||
pendingTab,
|
||||
saveHandler,
|
||||
saving,
|
||||
saveVisible,
|
||||
@@ -100,6 +122,8 @@ export const useModuleTabsStore = defineStore('moduleTabs', () => {
|
||||
unregisterTabs,
|
||||
setFloatingVisible,
|
||||
setActiveTab,
|
||||
setPendingTab,
|
||||
consumePendingTab,
|
||||
registerSave,
|
||||
runSave
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user