parent
3ed2355a45
commit
4858a1fc94
|
@ -42,6 +42,10 @@ const TabMenuSlots = [
|
|||
{
|
||||
name: 'item',
|
||||
description: 'Template of a menuitem.'
|
||||
},
|
||||
{
|
||||
name: 'itemicon',
|
||||
description: 'Custom item icon template.'
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -68,6 +68,20 @@ export interface TabMenuSlots {
|
|||
*/
|
||||
item: MenuItem;
|
||||
}): VNode[];
|
||||
/**
|
||||
* Custom item icon template.
|
||||
* @param {Object} scope - item icon slot's params.
|
||||
*/
|
||||
itemicon(scope: {
|
||||
/**
|
||||
* Menuitem instance
|
||||
*/
|
||||
item: MenuItem;
|
||||
/**
|
||||
* Style class of the item icon element.
|
||||
*/
|
||||
class: any;
|
||||
}): VNode[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
@click="onItemClick($event, item, i, navigate)"
|
||||
@keydown="onKeydownItem($event, item, i, navigate)"
|
||||
>
|
||||
<span v-if="item.icon" :class="getItemIcon(item)"></span>
|
||||
<component :is="$slots.itemicon || (item.icon ? 'span' : undefined)" :item="item" :class="getItemIcon(item)" />
|
||||
<span class="p-menuitem-text">{{ label(item) }}</span>
|
||||
</a>
|
||||
</template>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<li v-else-if="visible(item)" ref="tab" :class="getItemClass(item, i)" role="presentation" @click="onItemClick($event, item, i)" @keydown="onKeydownItem($event, item, i)">
|
||||
<template v-if="!$slots.item">
|
||||
<a ref="tabLink" v-ripple role="menuitem" :href="item.url" class="p-menuitem-link" :target="item.target" :aria-label="label(item)" :aria-disabled="disabled(item)" :tabindex="setTabIndex(i)">
|
||||
<span v-if="item.icon" :class="getItemIcon(item)"></span>
|
||||
<component :is="$slots.itemicon || (item.icon ? 'span' : undefined)" :item="item" :class="getItemIcon(item)" />
|
||||
<span class="p-menuitem-text">{{ label(item) }}</span>
|
||||
</a>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue