491 lines
18 KiB
Vue
491 lines
18 KiB
Vue
<template>
|
|
<DocSectionText v-bind="$attrs">
|
|
<p>Custom content can be placed inside the megamenu using the <i>start</i> and <i>end</i> properties.</p>
|
|
</DocSectionText>
|
|
<div class="card">
|
|
<MegaMenu :model="items" orientation="horizontal">
|
|
<template #start>
|
|
<span class="flex align-items-center">
|
|
<img alt="logo" src="https://primefaces.org/cdn/primevue/images/primevue-logo-dark.svg" height="24" class="mr-2" />
|
|
</span>
|
|
</template>
|
|
<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">
|
|
<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 :class="[hasSubmenu && 'pi pi-fw pi-angle-down']" v-bind="props.submenuicon" />
|
|
</a>
|
|
</template>
|
|
<template #end>
|
|
<InputText placeholder="Search" type="text" />
|
|
</template>
|
|
</MegaMenu>
|
|
</div>
|
|
<DocSectionCode :code="code" />
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
items: [
|
|
{
|
|
label: 'Videos',
|
|
icon: 'pi pi-fw pi-video',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'Video 1',
|
|
items: [{ label: 'Video 1.1' }, { label: 'Video 1.2' }]
|
|
},
|
|
{
|
|
label: 'Video 2',
|
|
items: [{ label: 'Video 2.1' }, { label: 'Video 2.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'Video 3',
|
|
items: [{ label: 'Video 3.1' }, { label: 'Video 3.2' }]
|
|
},
|
|
{
|
|
label: 'Video 4',
|
|
items: [{ label: 'Video 4.1' }, { label: 'Video 4.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Users',
|
|
icon: 'pi pi-fw pi-users',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'User 1',
|
|
items: [{ label: 'User 1.1' }, { label: 'User 1.2' }]
|
|
},
|
|
{
|
|
label: 'User 2',
|
|
items: [{ label: 'User 2.1' }, { label: 'User 2.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'User 3',
|
|
items: [{ label: 'User 3.1' }, { label: 'User 3.2' }]
|
|
},
|
|
{
|
|
label: 'User 4',
|
|
items: [{ label: 'User 4.1' }, { label: 'User 4.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'User 5',
|
|
items: [{ label: 'User 5.1' }, { label: 'User 5.2' }]
|
|
},
|
|
{
|
|
label: 'User 6',
|
|
items: [{ label: 'User 6.1' }, { label: 'User 6.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Events',
|
|
icon: 'pi pi-fw pi-calendar',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'Event 1',
|
|
items: [{ label: 'Event 1.1' }, { label: 'Event 1.2' }]
|
|
},
|
|
{
|
|
label: 'Event 2',
|
|
items: [{ label: 'Event 2.1' }, { label: 'Event 2.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'Event 3',
|
|
items: [{ label: 'Event 3.1' }, { label: 'Event 3.2' }]
|
|
},
|
|
{
|
|
label: 'Event 4',
|
|
items: [{ label: 'Event 4.1' }, { label: 'Event 4.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Settings',
|
|
icon: 'pi pi-fw pi-cog',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'Setting 1',
|
|
items: [{ label: 'Setting 1.1' }, { label: 'Setting 1.2' }]
|
|
},
|
|
{
|
|
label: 'Setting 2',
|
|
items: [{ label: 'Setting 2.1' }, { label: 'Setting 2.2' }]
|
|
},
|
|
{
|
|
label: 'Setting 3',
|
|
items: [{ label: 'Setting 3.1' }, { label: 'Setting 3.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'Technology 4',
|
|
items: [{ label: 'Setting 4.1' }, { label: 'Setting 4.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Upload',
|
|
icon: 'pi pi-fw pi-upload',
|
|
route: '/fileupload'
|
|
}
|
|
],
|
|
code: {
|
|
basic: `<MegaMenu :model="items" orientation="horizontal">
|
|
<template #start>
|
|
<img alt="logo" src="https://primefaces.org/cdn/primevue/images/primevue-logo-dark.svg" height="24" class="mr-2" />
|
|
</template>
|
|
<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">
|
|
<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 :class="[hasSubmenu && 'pi pi-fw pi-angle-down']" v-bind="props.submenuicon" />
|
|
</a>
|
|
</template>
|
|
<template #end>
|
|
<InputText placeholder="Search" type="text" />
|
|
</template>
|
|
</MegaMenu>`,
|
|
options: `<template>
|
|
<div class="card">
|
|
<MegaMenu :model="items" orientation="horizontal">
|
|
<template #start>
|
|
<span class="flex align-items-center">
|
|
<img alt="logo" src="https://primefaces.org/cdn/primevue/images/primevue-logo-dark.svg" height="24" class="mr-2" />
|
|
</span>
|
|
</template>
|
|
<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">
|
|
<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 :class="[hasSubmenu && 'pi pi-fw pi-angle-down']" v-bind="props.submenuicon" />
|
|
</a>
|
|
</template>
|
|
<template #end>
|
|
<InputText placeholder="Search" type="text" />
|
|
</template>
|
|
</MegaMenu>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
items: [
|
|
{
|
|
label: 'Videos',
|
|
icon: 'pi pi-fw pi-video',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'Video 1',
|
|
items: [{ label: 'Video 1.1' }, { label: 'Video 1.2' }]
|
|
},
|
|
{
|
|
label: 'Video 2',
|
|
items: [{ label: 'Video 2.1' }, { label: 'Video 2.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'Video 3',
|
|
items: [{ label: 'Video 3.1' }, { label: 'Video 3.2' }]
|
|
},
|
|
{
|
|
label: 'Video 4',
|
|
items: [{ label: 'Video 4.1' }, { label: 'Video 4.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Users',
|
|
icon: 'pi pi-fw pi-users',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'User 1',
|
|
items: [{ label: 'User 1.1' }, { label: 'User 1.2' }]
|
|
},
|
|
{
|
|
label: 'User 2',
|
|
items: [{ label: 'User 2.1' }, { label: 'User 2.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'User 3',
|
|
items: [{ label: 'User 3.1' }, { label: 'User 3.2' }]
|
|
},
|
|
{
|
|
label: 'User 4',
|
|
items: [{ label: 'User 4.1' }, { label: 'User 4.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'User 5',
|
|
items: [{ label: 'User 5.1' }, { label: 'User 5.2' }]
|
|
},
|
|
{
|
|
label: 'User 6',
|
|
items: [{ label: 'User 6.1' }, { label: 'User 6.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Events',
|
|
icon: 'pi pi-fw pi-calendar',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'Event 1',
|
|
items: [{ label: 'Event 1.1' }, { label: 'Event 1.2' }]
|
|
},
|
|
{
|
|
label: 'Event 2',
|
|
items: [{ label: 'Event 2.1' }, { label: 'Event 2.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'Event 3',
|
|
items: [{ label: 'Event 3.1' }, { label: 'Event 3.2' }]
|
|
},
|
|
{
|
|
label: 'Event 4',
|
|
items: [{ label: 'Event 4.1' }, { label: 'Event 4.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Settings',
|
|
icon: 'pi pi-fw pi-cog',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'Setting 1',
|
|
items: [{ label: 'Setting 1.1' }, { label: 'Setting 1.2' }]
|
|
},
|
|
{
|
|
label: 'Setting 2',
|
|
items: [{ label: 'Setting 2.1' }, { label: 'Setting 2.2' }]
|
|
},
|
|
{
|
|
label: 'Setting 3',
|
|
items: [{ label: 'Setting 3.1' }, { label: 'Setting 3.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'Technology 4',
|
|
items: [{ label: 'Setting 4.1' }, { label: 'Setting 4.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Upload',
|
|
icon: 'pi pi-fw pi-upload',
|
|
route: '/fileupload'
|
|
}
|
|
]
|
|
};
|
|
}
|
|
};
|
|
<\/script>`,
|
|
composition: `<MegaMenu :model="items" orientation="horizontal">
|
|
<template #start>
|
|
<span class="flex align-items-center">
|
|
<img alt="logo" src="https://primefaces.org/cdn/primevue/images/primevue-logo-dark.svg" height="24" class="mr-2" />
|
|
</span>
|
|
</template>
|
|
<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">
|
|
<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 :class="[hasSubmenu && 'pi pi-fw pi-angle-down']" v-bind="props.submenuicon" />
|
|
</a>
|
|
</template>
|
|
<template #end>
|
|
<InputText placeholder="Search" type="text" />
|
|
</template>
|
|
</MegaMenu>
|
|
|
|
<script setup>
|
|
import { ref } from "vue";
|
|
|
|
const items = ref([
|
|
{
|
|
label: 'Videos',
|
|
icon: 'pi pi-fw pi-video',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'Video 1',
|
|
items: [{ label: 'Video 1.1' }, { label: 'Video 1.2' }]
|
|
},
|
|
{
|
|
label: 'Video 2',
|
|
items: [{ label: 'Video 2.1' }, { label: 'Video 2.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'Video 3',
|
|
items: [{ label: 'Video 3.1' }, { label: 'Video 3.2' }]
|
|
},
|
|
{
|
|
label: 'Video 4',
|
|
items: [{ label: 'Video 4.1' }, { label: 'Video 4.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Users',
|
|
icon: 'pi pi-fw pi-users',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'User 1',
|
|
items: [{ label: 'User 1.1' }, { label: 'User 1.2' }]
|
|
},
|
|
{
|
|
label: 'User 2',
|
|
items: [{ label: 'User 2.1' }, { label: 'User 2.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'User 3',
|
|
items: [{ label: 'User 3.1' }, { label: 'User 3.2' }]
|
|
},
|
|
{
|
|
label: 'User 4',
|
|
items: [{ label: 'User 4.1' }, { label: 'User 4.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'User 5',
|
|
items: [{ label: 'User 5.1' }, { label: 'User 5.2' }]
|
|
},
|
|
{
|
|
label: 'User 6',
|
|
items: [{ label: 'User 6.1' }, { label: 'User 6.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Events',
|
|
icon: 'pi pi-fw pi-calendar',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'Event 1',
|
|
items: [{ label: 'Event 1.1' }, { label: 'Event 1.2' }]
|
|
},
|
|
{
|
|
label: 'Event 2',
|
|
items: [{ label: 'Event 2.1' }, { label: 'Event 2.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'Event 3',
|
|
items: [{ label: 'Event 3.1' }, { label: 'Event 3.2' }]
|
|
},
|
|
{
|
|
label: 'Event 4',
|
|
items: [{ label: 'Event 4.1' }, { label: 'Event 4.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Settings',
|
|
icon: 'pi pi-fw pi-cog',
|
|
items: [
|
|
[
|
|
{
|
|
label: 'Setting 1',
|
|
items: [{ label: 'Setting 1.1' }, { label: 'Setting 1.2' }]
|
|
},
|
|
{
|
|
label: 'Setting 2',
|
|
items: [{ label: 'Setting 2.1' }, { label: 'Setting 2.2' }]
|
|
},
|
|
{
|
|
label: 'Setting 3',
|
|
items: [{ label: 'Setting 3.1' }, { label: 'Setting 3.2' }]
|
|
}
|
|
],
|
|
[
|
|
{
|
|
label: 'Technology 4',
|
|
items: [{ label: 'Setting 4.1' }, { label: 'Setting 4.2' }]
|
|
}
|
|
]
|
|
]
|
|
},
|
|
{
|
|
label: 'Upload',
|
|
icon: 'pi pi-fw pi-upload',
|
|
route: '/fileupload'
|
|
}
|
|
]);
|
|
<\/script>`
|
|
}
|
|
};
|
|
}
|
|
};
|
|
</script>
|