mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-21 07:21:46 +01:00
feat(Tabs): control selected index (#490)
This commit is contained in:
22
docs/components/content/examples/TabsExampleChange.vue
Normal file
22
docs/components/content/examples/TabsExampleChange.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<script setup>
|
||||
const items = [{
|
||||
label: 'Tab1',
|
||||
content: 'This is the content shown for Tab1'
|
||||
}, {
|
||||
label: 'Tab2',
|
||||
content: 'And, this is the content for Tab2'
|
||||
}, {
|
||||
label: 'Tab3',
|
||||
content: 'Finally, this is the content for Tab3'
|
||||
}]
|
||||
|
||||
function onChange (index) {
|
||||
const item = items[index]
|
||||
|
||||
alert(`${item.label} was clicked!`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UTabs :items="items" @change="onChange" />
|
||||
</template>
|
||||
Reference in New Issue
Block a user