chore: clean and rearrange code
This commit is contained in:
parent
ced95331d7
commit
83d028ec15
1 changed files with 23 additions and 22 deletions
|
|
@ -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<boolean>('leftDrawerOpen', {
|
||||
default: true,
|
||||
});
|
||||
|
||||
const props = defineProps<{
|
||||
mini?: boolean;
|
||||
}>();
|
||||
|
||||
const role = ref();
|
||||
const router = useRouter();
|
||||
const userBranch = useMyBranch();
|
||||
const { currentMyBranch } = storeToRefs(userBranch);
|
||||
|
||||
const menuActive = ref<boolean[]>([false, false, false, false, false]);
|
||||
const menuData = ref<Menu[]>([]);
|
||||
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<Menu[]>([]);
|
||||
|
||||
const leftDrawerOpen = defineModel<boolean>('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,
|
||||
() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue