primevue-mirror/doc/tabmenu/ControlledDoc.vue

125 lines
3.0 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Visibility of the content is specified with the <i>activeIndex</i> property that supports one or two-way binding.</p>
</DocSectionText>
<div class="card">
2023-03-03 12:15:20 +00:00
<Button @click="active = 0" text outlined class="mb-2" label="Activate 1st" />
2023-02-28 08:29:30 +00:00
<TabMenu v-model:activeIndex="active" :model="items" />
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
active: 3,
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: {
2023-09-22 12:54:14 +00:00
basic: `
<Button @click="active = 0" text outlined label="Activate 1st" />
2023-10-15 09:38:39 +00:00
<TabMenu v-model:activeIndex="active" :model="items" />
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
2023-03-03 12:15:20 +00:00
<Button @click="active = 0" text outlined label="Activate 1st" />
2023-02-28 08:29:30 +00:00
<TabMenu v-model:activeIndex="active" :model="items" />
</div>
</template>
<script>
export default {
data() {
return {
active: 3,
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'
}
]
};
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
2023-03-03 12:15:20 +00:00
<Button @click="active = 0" text outlined label="Activate 1st" />
2023-02-28 08:29:30 +00:00
<TabMenu v-model:activeIndex="active" :model="items" />
</div>
</template>
<script setup>
import { ref } from "vue";
const active = ref(3);
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'
}
]);
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>