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 useMyBranch from 'stores/my-branch';
|
||||||
import { getUserId, getRole } from 'src/services/keycloak';
|
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<{
|
const props = defineProps<{
|
||||||
mini?: boolean;
|
mini?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const role = ref();
|
const role = ref();
|
||||||
const router = useRouter();
|
|
||||||
const userBranch = useMyBranch();
|
|
||||||
const { currentMyBranch } = storeToRefs(userBranch);
|
|
||||||
|
|
||||||
const menuActive = ref<boolean[]>([false, false, false, false, false]);
|
const menuActive = ref<boolean[]>([false, false, false, false, false]);
|
||||||
|
const menuData = ref<Menu[]>([]);
|
||||||
const currentPath = computed(() => {
|
const currentPath = computed(() => {
|
||||||
return router.currentRoute.value.path;
|
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) {
|
function navigateTo(label: string, destination?: string) {
|
||||||
if (!destination) return;
|
if (!destination) return;
|
||||||
router.push(`${destination}`);
|
router.push(`${destination}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function branchSetting() {}
|
|
||||||
|
|
||||||
function reActiveMenu() {
|
function reActiveMenu() {
|
||||||
menuActive.value.fill(false);
|
menuActive.value.fill(false);
|
||||||
|
|
||||||
|
|
@ -65,6 +62,10 @@ function reActiveMenu() {
|
||||||
menuActive.value[currMenuIndex] = true;
|
menuActive.value[currMenuIndex] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function branchSetting() {
|
||||||
|
//TODO: click setting (cog icon) on drawer menu
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => currentPath.value,
|
() => currentPath.value,
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue