2023-08-30 13:33:42 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<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
|
2023-08-30 14:38:19 +00:00
|
|
|
<i>NuxtLink</i> or <i>router-link</i>. Here is an example with vue-router.
|
2023-08-30 13:33:42 +00:00
|
|
|
</p>
|
|
|
|
</DocSectionText>
|
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<TieredMenu :model="items">
|
|
|
|
<template #item="{ label, item, props, hasSubmenu }">
|
|
|
|
<router-link v-if="item.route" v-slot="routerProps" :to="item.route" custom>
|
2023-10-16 15:12:36 +00:00
|
|
|
<a :href="routerProps.href" v-bind="props.action" @click="($event) => routerProps.navigate($event)">
|
2023-08-30 13:33:42 +00:00
|
|
|
<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>
|
|
|
|
<span v-if="hasSubmenu" class="pi pi-fw pi-angle-right" v-bind="props.submenuicon" />
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</TieredMenu>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'File',
|
|
|
|
icon: 'pi pi-fw pi-file',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'New',
|
|
|
|
icon: 'pi pi-fw pi-plus',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Bookmark',
|
|
|
|
icon: 'pi pi-fw pi-bookmark'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Video',
|
|
|
|
icon: 'pi pi-fw pi-video'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-trash'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
separator: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Export',
|
|
|
|
icon: 'pi pi-fw pi-external-link'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Edit',
|
|
|
|
icon: 'pi pi-fw pi-pencil',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Left',
|
|
|
|
icon: 'pi pi-fw pi-align-left'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Right',
|
|
|
|
icon: 'pi pi-fw pi-align-right'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Center',
|
|
|
|
icon: 'pi pi-fw pi-align-center'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Justify',
|
|
|
|
icon: 'pi pi-fw pi-align-justify'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Users',
|
|
|
|
icon: 'pi pi-fw pi-user',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'New',
|
|
|
|
icon: 'pi pi-fw pi-user-plus'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-user-minus'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Search',
|
|
|
|
icon: 'pi pi-fw pi-users',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Filter',
|
|
|
|
icon: 'pi pi-fw pi-filter',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Print',
|
|
|
|
icon: 'pi pi-fw pi-print'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'pi pi-fw pi-bars',
|
|
|
|
label: 'List'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Events',
|
|
|
|
icon: 'pi pi-fw pi-calendar',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Edit',
|
|
|
|
icon: 'pi pi-fw pi-pencil',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Save',
|
|
|
|
icon: 'pi pi-fw pi-calendar-plus'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-calendar-minus'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Archieve',
|
|
|
|
icon: 'pi pi-fw pi-calendar-times',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Remove',
|
|
|
|
icon: 'pi pi-fw pi-calendar-minus'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Upload',
|
|
|
|
icon: 'pi pi-fw pi-upload',
|
|
|
|
route: '/fileupload'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
separator: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Quit',
|
|
|
|
icon: 'pi pi-fw pi-power-off'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
2023-10-16 15:12:36 +00:00
|
|
|
<TieredMenu :model="items">
|
|
|
|
<template #item="{ label, item, props, hasSubmenu }">
|
|
|
|
<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)">
|
|
|
|
<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>
|
|
|
|
<span v-if="hasSubmenu" class="pi pi-fw pi-angle-right" v-bind="props.submenuicon" />
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</TieredMenu>
|
2023-10-15 09:38:39 +00:00
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2023-08-30 13:33:42 +00:00
|
|
|
<div class="card flex justify-content-center">
|
2023-10-16 15:12:36 +00:00
|
|
|
<TieredMenu :model="items">
|
|
|
|
<template #item="{ label, item, props, hasSubmenu }">
|
|
|
|
<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)">
|
|
|
|
<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>
|
|
|
|
<span v-if="hasSubmenu" class="pi pi-fw pi-angle-right" v-bind="props.submenuicon" />
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</TieredMenu>
|
2023-08-30 13:33:42 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'File',
|
|
|
|
icon: 'pi pi-fw pi-file',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'New',
|
|
|
|
icon: 'pi pi-fw pi-plus',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Bookmark',
|
|
|
|
icon: 'pi pi-fw pi-bookmark'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Video',
|
|
|
|
icon: 'pi pi-fw pi-video'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-trash'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
separator: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Export',
|
|
|
|
icon: 'pi pi-fw pi-external-link'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Edit',
|
|
|
|
icon: 'pi pi-fw pi-pencil',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Left',
|
|
|
|
icon: 'pi pi-fw pi-align-left'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Right',
|
|
|
|
icon: 'pi pi-fw pi-align-right'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Center',
|
|
|
|
icon: 'pi pi-fw pi-align-center'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Justify',
|
|
|
|
icon: 'pi pi-fw pi-align-justify'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Users',
|
|
|
|
icon: 'pi pi-fw pi-user',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'New',
|
|
|
|
icon: 'pi pi-fw pi-user-plus'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-user-minus'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Search',
|
|
|
|
icon: 'pi pi-fw pi-users',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Filter',
|
|
|
|
icon: 'pi pi-fw pi-filter',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Print',
|
|
|
|
icon: 'pi pi-fw pi-print'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'pi pi-fw pi-bars',
|
|
|
|
label: 'List'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Events',
|
|
|
|
icon: 'pi pi-fw pi-calendar',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Edit',
|
|
|
|
icon: 'pi pi-fw pi-pencil',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Save',
|
|
|
|
icon: 'pi pi-fw pi-calendar-plus'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-calendar-minus'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Archieve',
|
|
|
|
icon: 'pi pi-fw pi-calendar-times',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Remove',
|
|
|
|
icon: 'pi pi-fw pi-calendar-minus'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Upload',
|
|
|
|
icon: 'pi pi-fw pi-upload',
|
|
|
|
route: '/fileupload'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
separator: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Quit',
|
|
|
|
icon: 'pi pi-fw pi-power-off'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2023-08-30 13:33:42 +00:00
|
|
|
<div class="card flex justify-content-center">
|
2023-10-16 15:12:36 +00:00
|
|
|
<TieredMenu :model="items">
|
|
|
|
<template #item="{ label, item, props, hasSubmenu }">
|
|
|
|
<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)">
|
|
|
|
<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>
|
|
|
|
<span v-if="hasSubmenu" class="pi pi-fw pi-angle-right" v-bind="props.submenuicon" />
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</TieredMenu>
|
2023-08-30 13:33:42 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref } from "vue";
|
|
|
|
|
|
|
|
const items = ref([
|
|
|
|
{
|
|
|
|
label: 'File',
|
|
|
|
icon: 'pi pi-fw pi-file',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'New',
|
|
|
|
icon: 'pi pi-fw pi-plus',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Bookmark',
|
|
|
|
icon: 'pi pi-fw pi-bookmark'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Video',
|
|
|
|
icon: 'pi pi-fw pi-video'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-trash'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
separator: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Export',
|
|
|
|
icon: 'pi pi-fw pi-external-link'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Edit',
|
|
|
|
icon: 'pi pi-fw pi-pencil',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Left',
|
|
|
|
icon: 'pi pi-fw pi-align-left'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Right',
|
|
|
|
icon: 'pi pi-fw pi-align-right'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Center',
|
|
|
|
icon: 'pi pi-fw pi-align-center'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Justify',
|
|
|
|
icon: 'pi pi-fw pi-align-justify'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Users',
|
|
|
|
icon: 'pi pi-fw pi-user',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'New',
|
|
|
|
icon: 'pi pi-fw pi-user-plus'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-user-minus'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Search',
|
|
|
|
icon: 'pi pi-fw pi-users',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Filter',
|
|
|
|
icon: 'pi pi-fw pi-filter',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Print',
|
|
|
|
icon: 'pi pi-fw pi-print'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'pi pi-fw pi-bars',
|
|
|
|
label: 'List'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Events',
|
|
|
|
icon: 'pi pi-fw pi-calendar',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Edit',
|
|
|
|
icon: 'pi pi-fw pi-pencil',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Save',
|
|
|
|
icon: 'pi pi-fw pi-calendar-plus'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-calendar-minus'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Archieve',
|
|
|
|
icon: 'pi pi-fw pi-calendar-times',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Remove',
|
|
|
|
icon: 'pi pi-fw pi-calendar-minus'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Upload',
|
|
|
|
icon: 'pi pi-fw pi-upload',
|
|
|
|
route: '/fileupload'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
separator: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Quit',
|
|
|
|
icon: 'pi pi-fw pi-power-off'
|
|
|
|
}
|
|
|
|
]);
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`
|
2023-08-30 13:33:42 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|