|
|
|
@ -27,7 +27,10 @@ const createSidebar = (id: string, props: UseSidebarProps = {}) => {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (props.useStorage) { |
|
|
|
|
const storage = toRefs(useStorage(id, { isOpen, hasSidebar }, localStorage, { mergeDefaults: true }).value) |
|
|
|
|
const storage = toRefs(useStorage(id, { isOpen, hasSidebar }, localStorage).value) |
|
|
|
|
isOpen.value = storage.isOpen.value |
|
|
|
|
hasSidebar.value = storage.hasSidebar.value |
|
|
|
|
|
|
|
|
|
syncRef(isOpen, storage.isOpen) |
|
|
|
|
syncRef(hasSidebar, storage.hasSidebar) |
|
|
|
|
} |
|
|
|
@ -58,7 +61,7 @@ const createSidebar = (id: string, props: UseSidebarProps = {}) => {
|
|
|
|
|
|
|
|
|
|
const leftSidebar = createSharedComposable(() => createSidebar('leftSidebar')) |
|
|
|
|
|
|
|
|
|
const rightSidebar = createSharedComposable(() => createSidebar('rightSidebar', { useStorage: true })) |
|
|
|
|
const rightSidebar = createSharedComposable(() => createSidebar('rightSidebar', { useStorage: true, isOpen: true })) |
|
|
|
|
|
|
|
|
|
export const useSidebar = (id: string, props: UseSidebarProps = {}) => { |
|
|
|
|
const sidebar = id.includes('left') ? leftSidebar() : rightSidebar() |
|
|
|
|