2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<li v-for="(menuitem, index) in menu" :key="`_root${index}`">
|
2023-07-10 14:42:43 +00:00
|
|
|
<button v-if="menuitem.children && root" v-styleclass="{ selector: '@next', enterClass: 'hidden', enterActiveClass: 'slidedown', leaveToClass: 'hidden', leaveActiveClass: 'slideup' }" type="button" class="px-link">
|
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>
|
|
|
|
<Badge v-if="menuitem.badge" :value="menuitem.badge" class="ml-auto"></Badge>
|
2023-02-28 08:29:30 +00:00
|
|
|
</a>
|
2023-03-26 05:22:57 +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>
|
|
|
|
<Badge v-if="menuitem.badge" :value="menuitem.badge" class="ml-auto"></Badge>
|
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) {
|
|
|
|
return menuitem.children && !menuitem.children.some((item) => item.to === `/${this.$router.currentRoute.value.name}` || (item.children && item.children.some((it) => it.to === `/${this.$router.currentRoute.value.name}`)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|