45 lines
1.1 KiB
Vue
45 lines
1.1 KiB
Vue
<template>
|
|
<el-menu
|
|
:default-active="activeMenu"
|
|
class="app-sidebar"
|
|
@select="handleSelect"
|
|
>
|
|
<el-sub-menu v-for="section in navigation.sections" :key="section.key" :index="section.key">
|
|
<template #title>{{ section.label }}</template>
|
|
<el-menu-item v-for="item in section.items" :key="item.path" :index="item.path">
|
|
{{ item.label }}
|
|
</el-menu-item>
|
|
</el-sub-menu>
|
|
<el-menu-item v-for="item in navigation.standalone" :key="item.path" :index="item.path">
|
|
{{ item.label }}
|
|
</el-menu-item>
|
|
</el-menu>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from 'vue'
|
|
import { useAuthStore } from '../../stores/auth'
|
|
import { getNavigationMenu } from '../../navigation/menu'
|
|
|
|
const props = defineProps({
|
|
activeMenu: String
|
|
})
|
|
|
|
const emit = defineEmits(['menu-select'])
|
|
|
|
const authStore = useAuthStore()
|
|
|
|
const navigation = computed(() => getNavigationMenu({ isAdmin: authStore.isAdmin }))
|
|
|
|
function handleSelect(path) {
|
|
emit('menu-select', path)
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.app-sidebar {
|
|
height: 100%;
|
|
overflow-y: auto;
|
|
}
|
|
</style>
|