Search code examples
vuejs3vue-composition-apitabviewprimevue

How to use/capture Primevue's Tabview component's "tab-change" event in vue3 composition API?


What I have read in Primevue documentation, does not seem enough to figure it out. I did not find adequate examples at all, and the docs only says:

Primevue docs about the issue

1

Can someone help me out? I am stuck.


Solution

  • I hope this example helps, please comment if you need more information:

    <template>
    <div>
        <TabView @tab-change="onTabChange">
            <TabPanel header="A"></TabPanel>
            <TabPanel header="B"></TabPanel>
        </TabView>
    </div>
    </template>
    
    <script setup>
    function onTabChange(event) {
        console.log(event)
    }
    </script>