pull/4782/head
tugcekucukoglu 2023-11-09 11:42:27 +03:00
commit 13159884bc
11 changed files with 398 additions and 630 deletions

View File

@ -3,17 +3,7 @@
<p>TabMenu requires a collection of menuitems as its <i>model</i>.</p> <p>TabMenu requires a collection of menuitems as its <i>model</i>.</p>
</DocSectionText> </DocSectionText>
<div class="card"> <div class="card">
<TabMenu v-model:activeIndex="active" :model="items"> <TabMenu :model="items" />
<template #item="{ label, item, props }">
<router-link v-if="item.route" v-slot="routerProps" :to="item.route" custom>
<a :href="routerProps.href" v-bind="props.action" @click="($event) => routerProps.navigate($event)" @keydown.enter.space="($event) => routerProps.navigate($event)">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</router-link>
</template>
</TabMenu>
<router-view />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -22,42 +12,20 @@
export default { export default {
data() { data() {
return { return {
active: 0,
items: [ items: [
{ label: 'Home', icon: 'pi pi-fw pi-home', route: '/tabmenu/' }, { label: 'Dashboard', icon: 'pi pi-home' },
{ label: 'Calendar', icon: 'pi pi-fw pi-calendar', route: '/tabmenu/calendar' }, { label: 'Transactions', icon: 'pi pi-chart-line' },
{ label: 'Edit', icon: 'pi pi-fw pi-pencil', route: '/tabmenu/edit' }, { label: 'Products', icon: 'pi pi-list' },
{ label: 'Documentation', icon: 'pi pi-fw pi-file', route: '/tabmenu/documentation' }, { label: 'Messages', icon: 'pi pi-inbox' }
{ label: 'Settings', icon: 'pi pi-fw pi-cog', route: '/tabmenu/settings' }
], ],
code: { code: {
basic: ` basic: `
<TabMenu v-model:activeIndex="active" :model="items"> <TabMenu :model="items" />
<template #item="{ label, item, props }">
<router-link v-if="item.route" v-slot="routerProps" :to="item.route" custom>
<a :href="routerProps.href" v-bind="props.action" @click="($event) => routerProps.navigate($event)" @keydown.enter.space="($event) => routerProps.navigate($event)">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</router-link>
</template>
</TabMenu>
<router-view />
`, `,
options: ` options: `
<template> <template>
<div class="card"> <div class="card">
<TabMenu v-model:activeIndex="active" :model="items"> <TabMenu :model="items" />
<template #item="{ label, item, props }">
<router-link v-if="item.route" v-slot="routerProps" :to="item.route" custom>
<a :href="routerProps.href" v-bind="props.action" @click="($event) => routerProps.navigate($event)" @keydown.enter.space="($event) => routerProps.navigate($event)">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</router-link>
</template>
</TabMenu>
<router-view />
</div> </div>
</template> </template>
@ -65,43 +33,13 @@ export default {
export default { export default {
data() { data() {
return { return {
active: 0,
items: [ items: [
{ { label: 'Dashboard', icon: 'pi pi-home' },
label: 'Home', { label: 'Transactions', icon: 'pi pi-chart-line' },
icon: 'pi pi-fw pi-home', { label: 'Products', icon: 'pi pi-list' },
route: '/' { label: 'Messages', icon: 'pi pi-inbox' }
},
{
label: 'Calendar',
icon: 'pi pi-fw pi-calendar',
route: '/calendar'
},
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil',
route: '/edit'
},
{
label: 'Documentation',
icon: 'pi pi-fw pi-file',
route: '/documentation'
},
{
label: 'Settings',
icon: 'pi pi-fw pi-cog',
route: '/settings'
}
] ]
} }
},
watch: {
$route() {
this.active = this.items.findIndex((item) => this.$route.path === this.$router.resolve(item.route).path);
}
},
mounted() {
this.active = this.items.findIndex((item) => this.$route.path === this.$router.resolve(item.route).path);
} }
} }
<\/script> <\/script>
@ -109,161 +47,23 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card"> <div class="card">
<TabMenu v-model:activeIndex="active" :model="items"> <TabMenu :model="items" />
<template #item="{ label, item, props }">
<router-link v-if="item.route" v-slot="routerProps" :to="item.route" custom>
<a :href="routerProps.href" v-bind="props.action" @click="($event) => routerProps.navigate($event)" @keydown.enter.space="($event) => routerProps.navigate($event)">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</router-link>
</template>
</TabMenu>
<router-view />
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, watch } from "vue"; import { ref } from "vue";
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
const route = useRoute();
const active = ref(0);
const items = ref([ const items = ref([
{ { label: 'Dashboard', icon: 'pi pi-home' },
label: 'Home', { label: 'Transactions', icon: 'pi pi-chart-line' },
icon: 'pi pi-fw pi-home', { label: 'Products', icon: 'pi pi-list' },
route: '/' { label: 'Messages', icon: 'pi pi-inbox' }
},
{
label: 'Calendar',
icon: 'pi pi-fw pi-calendar',
route: '/calendar'
},
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil',
route: '/edit'
},
{
label: 'Documentation',
icon: 'pi pi-fw pi-file',
route: '/documentation'
},
{
label: 'Settings',
icon: 'pi pi-fw pi-cog',
route: '/settings'
}
]); ]);
onMounted(() => {
active.value = items.value.findIndex((item) => route.path === router.resolve(item.route).path);
})
watch(
route,
() => {
active.value = items.value.findIndex((item) => route.path === router.resolve(item.route).path);
},
{ immediate: true }
);
<\/script>
`,
pages: [
{
tabName: 'HomeDemo',
content: `
<template>
<div class="p-4">
<h5>Home Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script> <\/script>
` `
},
{
tabName: 'CalendarDemo',
content: `
<template>
<div class="p-4">
<h5>Calendar Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script>
`
},
{
tabName: 'EditDemo',
content: `
<template>
<div class="p-4">
<h5>Edit Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script>
`
},
{
tabName: 'DocumentationDemo',
content: `
<template>
<div class="p-4">
<h5>Documentation Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script>
`
},
{
tabName: 'SettingsDemo',
content: `
<template>
<div class="p-4">
<h5>Settings Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script>
`
}
]
} }
}; };
},
watch: {
$route() {
this.active = this.items.findIndex((item) => this.$route.path === this.$router.resolve(item.route).path);
}
},
mounted() {
this.active = this.items.findIndex((item) => this.$route.path === this.$router.resolve(item.route).path);
} }
}; };
</script> </script>

147
doc/tabmenu/CommandDoc.vue Normal file
View File

@ -0,0 +1,147 @@
<template>
<DocSectionText v-bind="$attrs">
<p>The <i>command</i> property defines the callback to run when an item is activated by click or a key event.</p>
</DocSectionText>
<div class="card">
<TabMenu :model="items" />
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Dashboard',
icon: 'pi pi-home',
command: () => {
this.$toast.add({ severity: 'success', summary: 'Selected', detail: 'Dashboard', life: 3000 });
}
},
{
label: 'Transactions',
icon: 'pi pi-chart-line',
command: () => {
this.$toast.add({ severity: 'success', summary: 'Selected', detail: 'Transactions', life: 3000 });
}
},
{
label: 'Products',
icon: 'pi pi-list',
command: () => {
this.$toast.add({ severity: 'success', summary: 'Selected', detail: 'Products', life: 3000 });
}
},
{
label: 'Messages',
icon: 'pi pi-inbox',
command: () => {
this.$toast.add({ severity: 'success', summary: 'Selected', detail: 'Messages', life: 3000 });
}
}
],
code: {
basic: `
<TabMenu :model="items" />
<Toast />
`,
options: `
<template>
<div class="card">
<TabMenu :model="items" />
<Toast />
</div>
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Dashboard',
icon: 'pi pi-home',
command: () => {
this.$toast.add({ severity: 'success', summary: 'Selected', detail: 'Dashboard', life: 3000 });
}
},
{
label: 'Transactions',
icon: 'pi pi-chart-line',
command: () => {
this.$toast.add({ severity: 'success', summary: 'Selected', detail: 'Transactions', life: 3000 });
}
},
{
label: 'Products',
icon: 'pi pi-list',
command: () => {
this.$toast.add({ severity: 'success', summary: 'Selected', detail: 'Products', life: 3000 });
}
},
{
label: 'Messages',
icon: 'pi pi-inbox',
command: () => {
this.$toast.add({ severity: 'success', summary: 'Selected', detail: 'Messages', life: 3000 });
}
}
]
}
}
}
<\/script>
`,
composition: `
<template>
<div class="card">
<TabMenu :model="items" />
<Toast />
</div>
</template>
<script setup>
import { ref } from "vue";
import { useToast } from "primevue/usetoast";
const toast = useToast();
const items = ref([
{
label: 'Dashboard',
icon: 'pi pi-home',
command: () => {
toast.add({ severity: 'success', summary: 'Selected', detail: 'Dashboard', life: 3000 });
}
},
{
label: 'Transactions',
icon: 'pi pi-chart-line',
command: () => {
toast.add({ severity: 'success', summary: 'Selected', detail: 'Transactions', life: 3000 });
}
},
{
label: 'Products',
icon: 'pi pi-list',
command: () => {
toast.add({ severity: 'success', summary: 'Selected', detail: 'Products', life: 3000 });
}
},
{
label: 'Messages',
icon: 'pi pi-inbox',
command: () => {
toast.add({ severity: 'success', summary: 'Selected', detail: 'Messages', life: 3000 });
}
}
]);
<\/script>
`
}
};
}
};
</script>

View File

@ -1,9 +1,14 @@
<template> <template>
<DocSectionText v-bind="$attrs"> <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> <p>Tabs can be controlled programmatically using <i>activeIndex</i> property.</p>
</DocSectionText> </DocSectionText>
<div class="card"> <div class="card">
<Button @click="active = 0" text outlined class="mb-2" label="Activate 1st" /> <div class="flex mb-2 gap-2 justify-content-end">
<Button @click="active = 0" rounded label="1" class="w-2rem h-2rem p-0" :outlined="active !== 0" />
<Button @click="active = 1" rounded label="2" class="w-2rem h-2rem p-0" :outlined="active !== 1" />
<Button @click="active = 2" rounded label="3" class="w-2rem h-2rem p-0" :outlined="active !== 2" />
</div>
<TabMenu v-model:activeIndex="active" :model="items" /> <TabMenu v-model:activeIndex="active" :model="items" />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
@ -13,38 +18,32 @@
export default { export default {
data() { data() {
return { return {
active: 3, active: 0,
items: [ items: [
{ { label: 'Dashboard', icon: 'pi pi-home' },
label: 'Home', { label: 'Transactions', icon: 'pi pi-chart-line' },
icon: 'pi pi-fw pi-home' { label: 'Products', icon: 'pi pi-list' },
}, { label: 'Messages', icon: 'pi pi-inbox' }
{
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: { code: {
basic: ` basic: `
<Button @click="active = 0" text outlined label="Activate 1st" /> <div class="flex mb-2 gap-2 justify-content-end">
<Button @click="active = 0" rounded label="1" class="w-2rem h-2rem p-0" :outlined="active !== 0" />
<Button @click="active = 1" rounded label="2" class="w-2rem h-2rem p-0" :outlined="active !== 1" />
<Button @click="active = 2" rounded label="3" class="w-2rem h-2rem p-0" :outlined="active !== 2" />
</div>
<TabMenu v-model:activeIndex="active" :model="items" /> <TabMenu v-model:activeIndex="active" :model="items" />
`, `,
options: ` options: `
<template> <template>
<div class="card"> <div class="card">
<Button @click="active = 0" text outlined label="Activate 1st" /> <div class="flex mb-2 gap-2 justify-content-end">
<Button @click="active = 0" rounded label="1" class="w-2rem h-2rem p-0" :outlined="active !== 0" />
<Button @click="active = 1" rounded label="2" class="w-2rem h-2rem p-0" :outlined="active !== 1" />
<Button @click="active = 2" rounded label="3" class="w-2rem h-2rem p-0" :outlined="active !== 2" />
</div>
<TabMenu v-model:activeIndex="active" :model="items" /> <TabMenu v-model:activeIndex="active" :model="items" />
</div> </div>
</template> </template>
@ -53,38 +52,27 @@ export default {
export default { export default {
data() { data() {
return { return {
active: 3, active: 0,
items: [ items: [
{ { label: 'Dashboard', icon: 'pi pi-home' },
label: 'Home', { label: 'Transactions', icon: 'pi pi-chart-line' },
icon: 'pi pi-fw pi-home' { label: 'Products', icon: 'pi pi-list' },
}, { label: 'Messages', icon: 'pi pi-inbox' }
{
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>
`, `,
composition: ` composition: `
<template> <template>
<div class="card"> <div class="card">
<Button @click="active = 0" text outlined label="Activate 1st" /> <div class="flex mb-2 gap-2 justify-content-end">
<Button @click="active.value = 0" rounded label="1" class="w-2rem h-2rem p-0" :outlined="active !== 0" />
<Button @click="active.value = 1" rounded label="2" class="w-2rem h-2rem p-0" :outlined="active !== 1" />
<Button @click="active.value = 2" rounded label="3" class="w-2rem h-2rem p-0" :outlined="active !== 2" />
</div>
<TabMenu v-model:activeIndex="active" :model="items" /> <TabMenu v-model:activeIndex="active" :model="items" />
</div> </div>
</template> </template>
@ -92,28 +80,13 @@ export default {
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
const active = ref(3); const active = ref(0);
const items = ref([ const items = ref([
{ { label: 'Dashboard', icon: 'pi pi-home' },
label: 'Home', { label: 'Transactions', icon: 'pi pi-chart-line' },
icon: 'pi pi-fw pi-home' { label: 'Products', icon: 'pi pi-list' },
}, { label: 'Messages', icon: 'pi pi-inbox' }
{
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>
` `

View File

@ -1,27 +1,23 @@
<template> <template>
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p> <p>Items with navigation are defined with templating to be able to use a router link component, an external link or programmatic navigation.</p>
Since v3.33.0 the vue-router dependency of menu components is deprecated and templating should be used to define router links instead. This approach provides flexibility to be able to use any kind of router link component such as
<i>NuxtLink</i> or <i>router-link</i>. Here is an example with vue-router.
</p>
</DocSectionText> </DocSectionText>
<!-- <div class="card"> <div class="card">
<TabMenu v-model:activeIndex="active" :model="items"> <TabMenu :model="items">
<template #item="{ label, item, props }"> <template #item="{ item, props }">
<router-link v-if="item.route" v-slot="routerProps" :to="item.route" custom> <router-link v-if="item.route" v-slot="{ href, navigate }" :to="item.route" custom>
<a :href="routerProps.href" v-bind="props.action" @click="($event) => routerProps.navigate($event)" @keydown.enter.space="($event) => routerProps.navigate($event)"> <a v-ripple :href="href" v-bind="props.action" @click="navigate">
<span v-bind="props.icon" /> <span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span> <span v-bind="props.label">{{ item.label }}</span>
</a> </a>
</router-link> </router-link>
<a v-else :href="item.url" :target="item.target" v-bind="props.action"> <a v-else v-ripple :href="item.url" :target="item.target" v-bind="props.action">
<span v-bind="props.icon" /> <span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span> <span v-bind="props.label">{{ item.label }}</span>
</a> </a>
</template> </template>
</TabMenu> </TabMenu>
<router-view /> </div>
</div> -->
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -29,51 +25,25 @@
export default { export default {
data() { data() {
return { return {
// active: 0, items: [
// items: [ { label: 'Router Link', icon: 'pi pi-home', route: '/tabmenu' },
// { label: 'Home', icon: 'pi pi-fw pi-home', route: '/tabmenu/' }, {
// { label: 'Calendar', icon: 'pi pi-fw pi-calendar', route: '/tabmenu/calendar' }, label: 'Programmatic',
// { label: 'Edit', icon: 'pi pi-fw pi-pencil', route: '/tabmenu/edit' }, icon: 'pi pi-palette',
// { label: 'Documentation', icon: 'pi pi-fw pi-file', route: '/tabmenu/documentation' }, command: () => {
// { label: 'Settings', icon: 'pi pi-fw pi-cog', route: '/tabmenu/settings' }, this.$router.push('/unstyled');
// { label: 'FileUpload', icon: 'pi pi-fw pi-upload', url: '/fileupload' } }
// ], },
{ label: 'External', icon: 'pi pi-link', url: 'https://vuejs.org/' }
],
code: { code: {
basic: ` basic: `
<TabMenu v-model:activeIndex="active" :model="items"> <TabMenu :model="items" />
<template #item="{ label, item, props }">
<router-link v-if="item.route" v-slot="routerProps" :to="item.route" custom>
<a :href="routerProps.href" v-bind="props.action" @click="($event) => routerProps.navigate($event)" @keydown.enter.space="($event) => routerProps.navigate($event)">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</router-link>
<a v-else :href="item.url" :target="item.target" v-bind="props.action">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</template>
</TabMenu>
<router-view />
`, `,
options: ` options: `
<template> <template>
<div class="card"> <div class="card">
<TabMenu v-model:activeIndex="active" :model="items"> <TabMenu :model="items" />
<template #item="{ label, item, props }">
<router-link v-if="item.route" v-slot="routerProps" :to="item.route" custom>
<a :href="routerProps.href" v-bind="props.action" @click="($event) => routerProps.navigate($event)" @keydown.enter.space="($event) => routerProps.navigate($event)">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</router-link>
<a v-else :href="item.url" :target="item.target" v-bind="props.action">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</template>
</TabMenu>
<router-view />
</div> </div>
</template> </template>
@ -81,48 +51,13 @@ export default {
export default { export default {
data() { data() {
return { return {
active: 0,
items: [ items: [
{ { label: 'Dashboard', icon: 'pi pi-home' },
label: 'Home', { label: 'Transactions', icon: 'pi pi-chart-line' },
icon: 'pi pi-fw pi-home', { label: 'Products', icon: 'pi pi-list' },
route: '/' { label: 'Messages', icon: 'pi pi-inbox' }
},
{
label: 'Calendar',
icon: 'pi pi-fw pi-calendar',
route: '/calendar'
},
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil',
route: '/edit'
},
{
label: 'Documentation',
icon: 'pi pi-fw pi-file',
route: '/documentation'
},
{
label: 'Settings',
icon: 'pi pi-fw pi-cog',
route: '/settings'
},
{
label: 'FileUpload',
icon: 'pi pi-fw pi-upload',
url: '/fileupload'
}
] ]
} }
},
watch: {
$route() {
this.active = this.items.findIndex((item) => this.$route.path === this.$router.resolve(item.route).path);
}
},
mounted() {
this.active = this.items.findIndex((item) => this.$route.path === this.$router.resolve(item.route).path);
} }
} }
<\/script> <\/script>
@ -130,171 +65,23 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card"> <div class="card">
<TabMenu v-model:activeIndex="active" :model="items"> <TabMenu :model="items" />
<template #item="{ label, item, props }">
<router-link v-if="item.route" v-slot="routerProps" :to="item.route" custom>
<a :href="routerProps.href" v-bind="props.action" @click="($event) => routerProps.navigate($event)" @keydown.enter.space="($event) => routerProps.navigate($event)">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</router-link>
<a v-else :href="item.url" :target="item.target" v-bind="props.action">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
</template>
</TabMenu>
<router-view />
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, watch } from "vue"; import { ref } from "vue";
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
const route = useRoute();
const active = ref(0);
const items = ref([ const items = ref([
{ { label: 'Dashboard', icon: 'pi pi-home' },
label: 'Home', { label: 'Transactions', icon: 'pi pi-chart-line' },
icon: 'pi pi-fw pi-home', { label: 'Products', icon: 'pi pi-list' },
route: '/' { label: 'Messages', icon: 'pi pi-inbox' }
},
{
label: 'Calendar',
icon: 'pi pi-fw pi-calendar',
route: '/calendar'
},
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil',
route: '/edit'
},
{
label: 'Documentation',
icon: 'pi pi-fw pi-file',
route: '/documentation'
},
{
label: 'Settings',
icon: 'pi pi-fw pi-cog',
route: '/settings'
},
{
label: 'FileUpload',
icon: 'pi pi-fw pi-upload',
url: '/fileupload'
}
]); ]);
onMounted(() => {
active.value = items.value.findIndex((item) => route.path === router.resolve(item.route).path);
})
watch(
route,
() => {
active.value = items.value.findIndex((item) => route.path === router.resolve(item.route).path);
},
{ immediate: true }
);
<\/script>
`,
pages: [
{
tabName: 'HomeDemo',
content: `
<template>
<div class="p-4">
<h5>Home Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script> <\/script>
` `
},
{
tabName: 'CalendarDemo',
content: `
<template>
<div class="p-4">
<h5>Calendar Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script>
`
},
{
tabName: 'EditDemo',
content: `
<template>
<div class="p-4">
<h5>Edit Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script>
`
},
{
tabName: 'DocumentationDemo',
content: `
<template>
<div class="p-4">
<h5>Documentation Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script>
`
},
{
tabName: 'SettingsDemo',
content: `
<template>
<div class="p-4">
<h5>Settings Component Content</h5>
</div>
</template>
<script>
export default {
}
<\/script>
`
}
]
} }
}; };
} }
// watch: {
// $route() {
// this.active = this.items.findIndex((item) => this.$route.path === this.$router.resolve(item.route).path);
// }
// },
// mounted() {
// this.active = this.items.findIndex((item) => this.$route.path === this.$router.resolve(item.route).path);
// }
}; };
</script> </script>

View File

@ -0,0 +1,94 @@
<template>
<DocSectionText v-bind="$attrs">
<p>TabMenu offers item customization with the <i>item</i> template that receives the menuitem instance from the model as a parameter.</p>
</DocSectionText>
<div class="card">
<TabMenu :model="items">
<template #item="{ item, props }">
<a v-ripple v-bind="props.action" class="flex align-items-center gap-2">
<img :alt="item.name" :src="`https://primefaces.org/cdn/primevue/images/avatar/${item.image}`" style="width: 32px" />
<span class="font-bold">{{ item.name }}</span>
</a>
</template>
</TabMenu>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{ name: 'Amy Elsner', image: 'amyelsner.png' },
{ name: 'Anna Fali', image: 'annafali.png' },
{ name: 'Asiya Javayant', image: 'asiyajavayant.png' }
],
code: {
basic: `
<TabMenu :model="items">
<template #item="{ item, props }">
<a v-ripple v-bind="props.action" class="flex align-items-center gap-2">
<img :alt="item.name" :src="\`/images/avatar/\${item.image}\`" style="width: 32px" />
<span class="font-bold">{{ item.name }}</span>
</a>
</template>
</TabMenu>
`,
options: `
<template>
<div class="card">
<TabMenu :model="items">
<template #item="{ item, props }">
<a v-ripple v-bind="props.action" class="flex align-items-center gap-2">
<img :alt="item.name" :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${item.image}\`" style="width: 32px" />
<span class="font-bold">{{ item.name }}</span>
</a>
</template>
</TabMenu>
</div>
</template>
<script>
export default {
data() {
return {
items: [
{ name: 'Amy Elsner', image: 'amyelsner.png' },
{ name: 'Anna Fali', image: 'annafali.png' },
{ name: 'Asiya Javayant', image: 'asiyajavayant.png' }
]
}
}
}
<\/script>
`,
composition: `
<template>
<div class="card">
<TabMenu :model="items">
<template #item="{ item, props }">
<a v-ripple v-bind="props.action" class="flex align-items-center gap-2">
<img :alt="item.name" :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${item.image}\`" style="width: 32px" />
<span class="font-bold">{{ item.name }}</span>
</a>
</template>
</TabMenu>
</div>
</template>
<script setup>
import { ref } from "vue";
const items = ref([
{ name: 'Amy Elsner', image: 'amyelsner.png' },
{ name: 'Anna Fali', image: 'annafali.png' },
{ name: 'Asiya Javayant', image: 'asiyajavayant.png' }
]);
<\/script>
`
}
};
}
};
</script>

View File

@ -1,57 +0,0 @@
<template>
<DocComponent
title="Vue TabMenu Component"
header="TabMenu"
description="TabMenu is a navigation/command component that displays items as tab headers."
:componentDocs="docs"
:apiDocs="['TabMenu', 'MenuItem']"
:ptTabComponent="ptComponent"
:themingDocs="themingDoc"
/>
</template>
<script>
import PTComponent from '@/doc/tabmenu/pt/index.vue';
import ThemingDoc from '@/doc/tabmenu/theming/index.vue';
import AccessibilityDoc from '../doc/tabmenu/AccessibilityDoc.vue';
import BasicDoc from '../doc/tabmenu/BasicDoc.vue';
import ControlledDoc from '../doc/tabmenu/ControlledDoc.vue';
import ImportDoc from '../doc/tabmenu/ImportDoc.vue';
import RouterDoc from '../doc/tabmenu/RouterDoc.vue';
export default {
data() {
return {
docs: [
{
id: 'import',
label: 'Import',
component: ImportDoc
},
{
id: 'basic',
label: 'Basic',
component: BasicDoc
},
{
id: 'controlled',
label: 'Controlled',
component: ControlledDoc
},
{
id: 'router',
label: 'Router',
component: RouterDoc
},
{
id: 'accessibility',
label: 'Accessibility',
component: AccessibilityDoc
}
],
ptComponent: PTComponent,
themingDoc: ThemingDoc
};
}
};
</script>

View File

@ -1,9 +0,0 @@
<template>
<div class="p-4">
<h3>Calendar Component Content</h3>
</div>
</template>
<script>
export default {};
</script>

View File

@ -1,9 +0,0 @@
<template>
<div class="p-4">
<h3>Documentation Component Content</h3>
</div>
</template>
<script>
export default {};
</script>

View File

@ -1,9 +0,0 @@
<template>
<div class="p-4">
<h3>Edit Component Content</h3>
</div>
</template>
<script>
export default {};
</script>

View File

@ -1,9 +0,0 @@
<template>
<div class="p-4">
<h3>Settings Component Content</h3>
</div>
</template>
<script>
export default {};
</script>

View File

@ -1,9 +1,69 @@
<template> <template>
<div class="p-4"> <DocComponent
<h3>Home Component Content</h3> title="Vue TabMenu Component"
</div> header="TabMenu"
description="TabMenu is a navigation component displaying menu items as tabs."
:componentDocs="docs"
:apiDocs="['TabMenu', 'MenuItem']"
:ptTabComponent="ptComponent"
:themingDocs="themingDoc"
/>
</template> </template>
<script> <script>
export default {}; import AccessibilityDoc from '@/doc/tabmenu/AccessibilityDoc.vue';
import BasicDoc from '@/doc/tabmenu/BasicDoc.vue';
import ControlledDoc from '@/doc/tabmenu/ControlledDoc.vue';
import ImportDoc from '@/doc/tabmenu/ImportDoc.vue';
import RouterDoc from '@/doc/tabmenu/RouterDoc.vue';
import CommandDoc from '@/doc/tabmenu/CommandDoc.vue';
import TemplateDoc from '@/doc/tabmenu/TemplateDoc.vue';
import PTComponent from '@/doc/tabmenu/pt/index.vue';
import ThemingDoc from '@/doc/tabmenu/theming/index.vue';
export default {
data() {
return {
docs: [
{
id: 'import',
label: 'Import',
component: ImportDoc
},
{
id: 'basic',
label: 'Basic',
component: BasicDoc
},
{
id: 'controlled',
label: 'Controlled',
component: ControlledDoc
},
{
id: 'template',
label: 'Template',
component: TemplateDoc
},
{
id: 'command',
label: 'Command',
component: CommandDoc
},
{
id: 'router',
label: 'Router',
component: RouterDoc
},
{
id: 'accessibility',
label: 'Accessibility',
component: AccessibilityDoc
}
],
ptComponent: PTComponent,
themingDoc: ThemingDoc
};
}
};
</script> </script>