30 lines
938 B
Vue
30 lines
938 B
Vue
|
|
<script setup lang="ts">
|
||
|
|
import { useInventory } from '@/modules/inventory/composables/useInventory'
|
||
|
|
|
||
|
|
const { state, menuGroups, openGroups, toggleGroup, handleMenuClick } = useInventory()
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<template>
|
||
|
|
<el-menu
|
||
|
|
:default-active="state.activeTab"
|
||
|
|
class="inventory-sidebar"
|
||
|
|
@select="(key: string) => handleMenuClick(key)"
|
||
|
|
>
|
||
|
|
<div v-for="group in menuGroups" :key="group.key" class="sidebar-group">
|
||
|
|
<div class="sidebar-group-title" @click="toggleGroup(group.key)">
|
||
|
|
<span>{{ group.title }}</span>
|
||
|
|
<el-icon><component :is="openGroups[group.key] ? 'ArrowDown' : 'ArrowRight'" /></el-icon>
|
||
|
|
</div>
|
||
|
|
<template v-if="openGroups[group.key]">
|
||
|
|
<el-menu-item
|
||
|
|
v-for="item in group.items"
|
||
|
|
:key="group.key + '-' + item.key"
|
||
|
|
:index="item.key"
|
||
|
|
>
|
||
|
|
{{ item.label }}
|
||
|
|
</el-menu-item>
|
||
|
|
</template>
|
||
|
|
</div>
|
||
|
|
</el-menu>
|
||
|
|
</template>
|