From daf6034d98a1c80dd32a8449aff1b10ca8f11dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 25 Jul 2023 12:11:57 +0300 Subject: [PATCH] Refactor #4190 - For TabMenu --- components/lib/tabmenu/TabMenu.d.ts | 4 ++++ components/lib/tabmenu/TabMenu.vue | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/components/lib/tabmenu/TabMenu.d.ts b/components/lib/tabmenu/TabMenu.d.ts index 76259c790..e109da770 100755 --- a/components/lib/tabmenu/TabMenu.d.ts +++ b/components/lib/tabmenu/TabMenu.d.ts @@ -86,6 +86,10 @@ export interface TabMenuState { * Defines current options in TabMenu component. */ export interface TabMenuContext { + /** + * Current menuitem + */ + item: any; /** * Index of the menuitem */ diff --git a/components/lib/tabmenu/TabMenu.vue b/components/lib/tabmenu/TabMenu.vue index b3bb13d26..7709e4db4 100755 --- a/components/lib/tabmenu/TabMenu.vue +++ b/components/lib/tabmenu/TabMenu.vue @@ -9,7 +9,7 @@ :class="[cx('menuitem', { item, isActive, isExactActive }), item.class]" :style="item.style" role="presentation" - v-bind="getPTOptions('menuitem', i)" + v-bind="getPTOptions('menuitem', item, i)" :data-p-highlight="exact ? isExactActive : isActive" :data-p-disabled="disabled(item)" > @@ -25,11 +25,11 @@ :tabindex="-1" @click="onItemClick($event, item, i, navigate)" @keydown="onKeydownItem($event, item, i, navigate)" - v-bind="getPTOptions('action', i)" + v-bind="getPTOptions('action', item, i)" > - - {{ label(item) }} + + {{ label(item) }} @@ -42,15 +42,15 @@ role="presentation" @click="onItemClick($event, item, i)" @keydown="onKeydownItem($event, item, i)" - v-bind="getPTOptions('menuitem', i)" + v-bind="getPTOptions('menuitem', item, i)" :data-p-highlight="d_activeIndex === i" :data-p-disabled="disabled(item)" > @@ -98,9 +98,10 @@ export default { clearTimeout(this.timeout); }, methods: { - getPTOptions(key, index) { + getPTOptions(key, item, index) { return this.ptm(key, { context: { + item, index } });