2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<li v-for="(menuitem, index) in menu" :key="`_root${index}`">
|
2024-03-28 14:34:15 +00:00
|
|
|
<button v-if="menuitem.children && root" v-styleclass="{ selector: '@next', enterClass: 'hidden', enterActiveClass: 'slidedown', leaveToClass: 'hidden', leaveActiveClass: 'slideup' }" type="button">
|
2023-09-09 23:25:16 +00:00
|
|
|
<span class="menu-icon">
|
2023-02-28 08:29:30 +00:00
|
|
|
<i :class="menuitem.icon"></i>
|
2023-09-09 23:25:16 +00:00
|
|
|
</span>
|
2023-02-28 08:29:30 +00:00
|
|
|
<span>{{ menuitem.name }}</span>
|
|
|
|
<i class="menu-toggle-icon pi pi-angle-down"></i>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<a v-if="menuitem.href" :href="menuitem.href" target="_blank" rel="noopener noreferrer">
|
2023-09-09 23:25:16 +00:00
|
|
|
<span v-if="menuitem.icon && root" class="menu-icon">
|
2023-02-28 08:29:30 +00:00
|
|
|
<i :class="menuitem.icon"></i>
|
2023-09-09 23:25:16 +00:00
|
|
|
</span>
|
|
|
|
<span>{{ menuitem.name }}</span>
|
2024-02-04 11:10:58 +00:00
|
|
|
<Tag v-if="menuitem.badge" :value="menuitem.badge" class="ml-auto"></Tag>
|
2023-02-28 08:29:30 +00:00
|
|
|
</a>
|
2023-12-20 17:23:55 +00:00
|
|
|
<PrimeVueNuxtLink v-if="menuitem.to" :to="menuitem.to" :class="{ 'router-link-active': menuitem.to === $route.fullPath }">
|
2023-09-09 23:25:16 +00:00
|
|
|
<span v-if="menuitem.icon && root" class="menu-icon">
|
2023-02-28 08:29:30 +00:00
|
|
|
<i :class="menuitem.icon"></i>
|
2023-09-09 23:25:16 +00:00
|
|
|
</span>
|
|
|
|
<span>{{ menuitem.name }}</span>
|
2024-02-04 22:21:29 +00:00
|
|
|
<Tag v-if="menuitem.badge" :value="menuitem.badge"></Tag>
|
2023-03-26 05:22:57 +00:00
|
|
|
</PrimeVueNuxtLink>
|
2023-02-28 08:29:30 +00:00
|
|
|
|
|
|
|
<span v-if="!root && menuitem.children" class="menu-child-category">{{ menuitem.name }}</span>
|
2023-09-16 12:01:29 +00:00
|
|
|
<div v-if="menuitem.children" class="overflow-y-hidden transition-all transition-duration-400 transition-ease-in-out" :class="{ hidden: menuitem.children && root && isActiveRootmenuItem(menuitem) }">
|
2023-02-28 08:29:30 +00:00
|
|
|
<ol>
|
|
|
|
<AppMenuItem :root="false" :menu="menuitem.children"></AppMenuItem>
|
|
|
|
</ol>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
root: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
menu: {
|
|
|
|
type: Object,
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
isActiveRootmenuItem(menuitem) {
|
2023-12-25 10:59:01 +00:00
|
|
|
return (
|
|
|
|
menuitem.children && !menuitem.children.some((item) => item.to === `/${this.$router.currentRoute.value?.name?.replace('-', '/')}` || (item.children && item.children.some((it) => it.to === `/${this.$router.currentRoute.value.name}`)))
|
|
|
|
);
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|