feat(web): 侧边栏状态持久化
This commit is contained in:
parent
fed559dbfc
commit
a9d05480f0
@ -17,6 +17,7 @@ import {
|
||||
import { useConfigStore } from '@/stores/config'
|
||||
import { useAgentStore } from '@/stores/agent'
|
||||
import { useChatThreadsStore } from '@/stores/chatThreads'
|
||||
import { useChatUIStore } from '@/stores/chatUI'
|
||||
import { useDatabaseStore } from '@/stores/database'
|
||||
import { useInfoStore } from '@/stores/info'
|
||||
import { useTaskerStore } from '@/stores/tasker'
|
||||
@ -31,6 +32,7 @@ import ConversationNavSection from '@/components/ConversationNavSection.vue'
|
||||
const configStore = useConfigStore()
|
||||
const agentStore = useAgentStore()
|
||||
const chatThreadsStore = useChatThreadsStore()
|
||||
const chatUIStore = useChatUIStore()
|
||||
const databaseStore = useDatabaseStore()
|
||||
const infoStore = useInfoStore()
|
||||
const taskerStore = useTaskerStore()
|
||||
@ -54,7 +56,7 @@ const showDebugModal = ref(false)
|
||||
// Add state for settings modal
|
||||
const showSettingsModal = ref(false)
|
||||
|
||||
const sidebarCollapsed = ref(false)
|
||||
const { sidebarCollapsed } = storeToRefs(chatUIStore)
|
||||
|
||||
// Provide settings modal methods to child components
|
||||
const openSettingsModal = () => {
|
||||
|
||||
@ -13,6 +13,9 @@ export const useChatUIStore = defineStore('chatUI', () => {
|
||||
// 配置侧边栏
|
||||
const isConfigSidebarOpen = ref(false)
|
||||
|
||||
// 应用侧边栏折叠态
|
||||
const sidebarCollapsed = ref(false)
|
||||
|
||||
// 更多菜单
|
||||
const moreMenuOpen = ref(false)
|
||||
const moreMenuPosition = ref({ x: 0, y: 0 })
|
||||
@ -51,6 +54,7 @@ export const useChatUIStore = defineStore('chatUI', () => {
|
||||
isLoadingMessages,
|
||||
agentModalOpen,
|
||||
isConfigSidebarOpen,
|
||||
sidebarCollapsed,
|
||||
moreMenuOpen,
|
||||
moreMenuPosition,
|
||||
|
||||
@ -59,4 +63,10 @@ export const useChatUIStore = defineStore('chatUI', () => {
|
||||
closeMoreMenu,
|
||||
reset
|
||||
}
|
||||
}, {
|
||||
persist: {
|
||||
key: 'chat-ui-store',
|
||||
storage: localStorage,
|
||||
pick: ['sidebarCollapsed']
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user