侧边栏状态持久化存储
This commit is contained in:
parent
246a3aa875
commit
d8f2f8490d
@ -41,9 +41,16 @@ const convs = reactive(JSON.parse(localStorage.getItem('chat-convs')) || [
|
|||||||
])
|
])
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
isSidebarOpen: true,
|
isSidebarOpen: JSON.parse(localStorage.getItem('chat-sidebar-open') || 'true'),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Watch isSidebarOpen and save to localStorage
|
||||||
|
watch(
|
||||||
|
() => state.isSidebarOpen,
|
||||||
|
(newValue) => {
|
||||||
|
localStorage.setItem('chat-sidebar-open', JSON.stringify(newValue))
|
||||||
|
}
|
||||||
|
)
|
||||||
const curConvId = ref(0)
|
const curConvId = ref(0)
|
||||||
|
|
||||||
const generateRandomHash = (length) => {
|
const generateRandomHash = (length) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user