primevue-mirror/doc/tabmenu/pt/PTDoc.vue

141 lines
3.1 KiB
Vue
Raw Normal View History

2023-04-28 07:24:00 +00:00
<template>
<DocSectionText v-bind="$attrs"></DocSectionText>
<div class="card">
<TabMenu
:model="items"
:pt="{
action: ({ props, state, options }) => ({
class: options.order === state.d_activeIndex ? 'bg-primary' : undefined
})
}"
/>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Home',
icon: 'pi pi-fw pi-home'
},
{
label: 'Calendar',
icon: 'pi pi-fw pi-calendar'
},
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil'
},
{
label: 'Documentation',
icon: 'pi pi-fw pi-file'
},
{
label: 'Settings',
icon: 'pi pi-fw pi-cog'
}
],
code: {
basic: `
<TabMenu
:model="items"
:pt="{
action: ({ props, state, index }) => ({
class: index === state.d_activeIndex ? 'bg-primary' : undefined
})
}"
/>`,
options: `
<template>
<div class="card">
<TabMenu
:model="items"
:pt="{
action: ({ props, state, index }) => ({
class: index === state.d_activeIndex ? 'bg-primary' : undefined
})
}"
/>
</div>
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Home',
icon: 'pi pi-fw pi-home'
},
{
label: 'Calendar',
icon: 'pi pi-fw pi-calendar'
},
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil'
},
{
label: 'Documentation',
icon: 'pi pi-fw pi-file'
},
{
label: 'Settings',
icon: 'pi pi-fw pi-cog'
}
]
};
}
};
<\/script>`,
composition: `
<template>
<div class="card">
<TabMenu
:model="items"
:pt="{
action: ({ props, state, index }) => ({
class: index === state.d_activeIndex ? 'bg-primary' : undefined
})
}"
/>
</div>
</template>
<script setup>
import { ref } from "vue";
const items = ref([
{
label: 'Home',
icon: 'pi pi-fw pi-home'
},
{
label: 'Calendar',
icon: 'pi pi-fw pi-calendar'
},
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil'
},
{
label: 'Documentation',
icon: 'pi pi-fw pi-file'
},
{
label: 'Settings',
icon: 'pi pi-fw pi-cog'
}
]);
<\/script>`
}
};
}
};
</script>