30 lines
678 B
TypeScript
30 lines
678 B
TypeScript
import { ref, computed } from 'vue'
|
|
import { defineStore } from 'pinia'
|
|
|
|
export const useSidebarStore = defineStore('sidebar', () => {
|
|
const isClose = ref(false);
|
|
|
|
function closeSidebar() {
|
|
isClose.value = true;
|
|
console.info("Close sidebar");
|
|
}
|
|
|
|
function openSidebar() {
|
|
isClose.value = false;
|
|
console.info("Open sidebar");
|
|
}
|
|
|
|
function toggleSidebar() {
|
|
if (isClose.value) {
|
|
openSidebar();
|
|
// themeSidebar.value = "card-dash sidebar-base sidebar-open"
|
|
} else {
|
|
closeSidebar();
|
|
// themeSidebar.value = "card-dash sidebar-base sidebar-close"
|
|
}
|
|
}
|
|
|
|
return { isClose, closeSidebar, openSidebar, toggleSidebar }
|
|
})
|
|
|