diff --git a/src/components/tabview/TabView.d.ts b/src/components/tabview/TabView.d.ts index 3dcc73bcb..643f83c2b 100755 --- a/src/components/tabview/TabView.d.ts +++ b/src/components/tabview/TabView.d.ts @@ -6,7 +6,8 @@ interface TabViewProps { declare class TabView { $props: TabViewProps; - $emit(eventName: 'tab-change', e: { originalEvent: Event, tab: any }): this; + $emit(eventName: 'tab-change', e: { originalEvent: Event, index: number }): this; + $emit(eventName: 'tab-click', e: { originalEvent: Event, index: number }): this; $slots: { '': VNode[]; } diff --git a/src/components/tabview/TabView.vue b/src/components/tabview/TabView.vue index b838b8c8b..7b99cec9d 100755 --- a/src/components/tabview/TabView.vue +++ b/src/components/tabview/TabView.vue @@ -22,7 +22,7 @@ import {DomHandler} from 'primevue/utils'; import Ripple from 'primevue/ripple'; export default { - emits: ['update:activeIndex', 'tab-change'], + emits: ['update:activeIndex', 'tab-change', 'tab-click'], props: { activeIndex: { type: Number, @@ -56,6 +56,11 @@ export default { index: i }); } + + this.$emit('tab-click', { + originalEvent: event, + index: i + }); }, onTabKeydown(event, i) { if (event.which === 13) { diff --git a/src/views/tabview/TabViewDoc.vue b/src/views/tabview/TabViewDoc.vue index 87b140563..17911ca82 100755 --- a/src/views/tabview/TabViewDoc.vue +++ b/src/views/tabview/TabViewDoc.vue @@ -221,9 +221,16 @@ export default { tab-change event.originalEvent: Browser event
- event.tab: Selected tab + event.index: Index of the selected tab Callback to invoke when an active tab is changed. + + + tab-click + event.originalEvent: Browser event
+ event.index: Index of the clicked tab + + Callback to invoke when an active tab is clicked.