优化更新
This commit is contained in:
@@ -26,6 +26,9 @@ export const useLayoutStore = defineStore(
|
||||
// 视图标签页(用于记录页面滚动位置)
|
||||
const viewTags = ref([])
|
||||
|
||||
// 刷新标签的 key,用于触发组件刷新
|
||||
const refreshKey = ref(0)
|
||||
|
||||
// 切换侧边栏折叠
|
||||
const toggleSidebar = () => {
|
||||
sidebarCollapsed.value = !sidebarCollapsed.value
|
||||
@@ -81,6 +84,11 @@ export const useLayoutStore = defineStore(
|
||||
showBreadcrumb.value = show
|
||||
}
|
||||
|
||||
// 刷新标签
|
||||
const refreshTag = () => {
|
||||
refreshKey.value++
|
||||
}
|
||||
|
||||
// 重置主题设置
|
||||
const resetTheme = () => {
|
||||
themeColor.value = '#1890ff'
|
||||
@@ -98,6 +106,7 @@ export const useLayoutStore = defineStore(
|
||||
themeColor,
|
||||
showTags,
|
||||
showBreadcrumb,
|
||||
refreshKey,
|
||||
toggleSidebar,
|
||||
setLayoutMode,
|
||||
setSelectedParentMenu,
|
||||
@@ -108,13 +117,14 @@ export const useLayoutStore = defineStore(
|
||||
setShowTags,
|
||||
setShowBreadcrumb,
|
||||
resetTheme,
|
||||
refreshTag,
|
||||
}
|
||||
},
|
||||
{
|
||||
persist: {
|
||||
key: 'layout-store',
|
||||
storage: customStorage,
|
||||
pick: ['layoutMode', 'sidebarCollapsed', 'themeColor', 'showTags', 'showBreadcrumb'],
|
||||
pick: ['layoutMode', 'sidebarCollapsed', 'themeColor', 'showTags', 'showBreadcrumb', 'viewTags'],
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user