Fixed #3393 - TabMenu: index of menu item must be accessible in slot

pull/3509/head
Tuğçe Küçükoğlu 2023-01-09 13:22:08 +03:00
parent a287b092c1
commit e8714865c0
2 changed files with 6 additions and 3 deletions

View File

@ -21,7 +21,7 @@
<span class="p-menuitem-text">{{ label(item) }}</span> <span class="p-menuitem-text">{{ label(item) }}</span>
</a> </a>
</template> </template>
<component v-else :is="$slots.item" :item="item"></component> <component v-else :is="$slots.item" :item="item" :index="i"></component>
</li> </li>
</router-link> </router-link>
<li v-else-if="visible(item)" ref="tab" :class="getItemClass(item, i)" role="presentation" @click="onItemClick($event, item, i)" @keydown="onKeydownItem($event, item, i)"> <li v-else-if="visible(item)" ref="tab" :class="getItemClass(item, i)" role="presentation" @click="onItemClick($event, item, i)" @keydown="onKeydownItem($event, item, i)">
@ -31,7 +31,7 @@
<span class="p-menuitem-text">{{ label(item) }}</span> <span class="p-menuitem-text">{{ label(item) }}</span>
</a> </a>
</template> </template>
<component v-else :is="$slots.item" :item="item"></component> <component v-else :is="$slots.item" :item="item" :index="i"></component>
</li> </li>
</template> </template>
<li ref="inkbar" class="p-tabmenu-ink-bar"></li> <li ref="inkbar" class="p-tabmenu-ink-bar"></li>

View File

@ -159,7 +159,10 @@ export default {
<tbody> <tbody>
<tr> <tr>
<td>item</td> <td>item</td>
<td>item: Menuitem instance</td> <td>
item: Menuitem instance<br />
index: Index of the menuitem instance
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>