Fixed #4779 - PanelMenu: root option for item templating

pull/4763/head
tugcekucukoglu 2023-11-08 16:10:03 +03:00
parent 5c6ffcc482
commit 466597181a
3 changed files with 6 additions and 1 deletions

View File

@ -296,6 +296,10 @@ export interface PanelMenuSlots {
* Menuitem instance * Menuitem instance
*/ */
item: MenuItem; item: MenuItem;
/**
* Whether there is a root menuitem
*/
root: boolean;
/** /**
* Current active state of the menuitem * Current active state of the menuitem
*/ */

View File

@ -28,7 +28,7 @@
<span :class="cx('headerLabel')" v-bind="getPTOptions('headerLabel', item, index)">{{ getItemLabel(item) }}</span> <span :class="cx('headerLabel')" v-bind="getPTOptions('headerLabel', item, index)">{{ getItemLabel(item) }}</span>
</a> </a>
</template> </template>
<component v-else :is="$slots.item" :item="item" :isActive="isItemActive(item)" :hasSubmenu="getItemProp(item, 'items')" :label="getItemLabel(item)" :props="getMenuItemProps(item, index)"></component> <component v-else :is="$slots.item" :item="item" :root="true" :isActive="isItemActive(item)" :hasSubmenu="getItemProp(item, 'items')" :label="getItemLabel(item)" :props="getMenuItemProps(item, index)"></component>
</div> </div>
</div> </div>
<transition name="p-toggleable-content" v-bind="ptm('transition')"> <transition name="p-toggleable-content" v-bind="ptm('transition')">

View File

@ -32,6 +32,7 @@
v-else v-else
:is="templates.item" :is="templates.item"
:item="processedItem.item" :item="processedItem.item"
:root="false"
:isActive="isItemActive(processedItem)" :isActive="isItemActive(processedItem)"
:hasSubmenu="isItemGroup(processedItem)" :hasSubmenu="isItemGroup(processedItem)"
:label="getItemLabel(processedItem)" :label="getItemLabel(processedItem)"