From 83d028ec15f2a6317ee885f7d49055b56e40dd85 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 30 Oct 2024 16:12:06 +0700 Subject: [PATCH] chore: clean and rearrange code --- src/layouts/DrawerComponent.vue | 45 +++++++++++++++++---------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/layouts/DrawerComponent.vue b/src/layouts/DrawerComponent.vue index 51ace954..e86a16d3 100644 --- a/src/layouts/DrawerComponent.vue +++ b/src/layouts/DrawerComponent.vue @@ -6,16 +6,31 @@ import { Icon } from '@iconify/vue'; import useMyBranch from 'stores/my-branch'; import { getUserId, getRole } from 'src/services/keycloak'; +type Menu = { + label: string; + route?: string; + icon?: string; + hidden?: boolean; + disabled?: boolean; + isax?: boolean; + children?: Menu[]; +}; + +const router = useRouter(); +const userBranch = useMyBranch(); +const { currentMyBranch } = storeToRefs(userBranch); + +const leftDrawerOpen = defineModel('leftDrawerOpen', { + default: true, +}); + const props = defineProps<{ mini?: boolean; }>(); const role = ref(); -const router = useRouter(); -const userBranch = useMyBranch(); -const { currentMyBranch } = storeToRefs(userBranch); - const menuActive = ref([false, false, false, false, false]); +const menuData = ref([]); const currentPath = computed(() => { return router.currentRoute.value.path; }); @@ -31,29 +46,11 @@ const currentPath = computed(() => { // }[] // >([]); -type Menu = { - label: string; - route?: string; - icon?: string; - hidden?: boolean; - disabled?: boolean; - isax?: boolean; - children?: Menu[]; -}; - -const menuData = ref([]); - -const leftDrawerOpen = defineModel('leftDrawerOpen', { - default: true, -}); - function navigateTo(label: string, destination?: string) { if (!destination) return; router.push(`${destination}`); } -function branchSetting() {} - function reActiveMenu() { menuActive.value.fill(false); @@ -65,6 +62,10 @@ function reActiveMenu() { menuActive.value[currMenuIndex] = true; } +function branchSetting() { + //TODO: click setting (cog icon) on drawer menu +} + watch( () => currentPath.value, () => {