primevue-mirror/apps/showcase/doc/menu/GroupDoc.vue

136 lines
3.1 KiB
Vue
Raw Permalink Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
2023-11-04 08:20:02 +00:00
<p>Menu supports single level of grouping by defining children with the <i>items</i> property.</p>
2023-02-28 08:29:30 +00:00
</DocSectionText>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
2023-02-28 08:29:30 +00:00
<Menu :model="items" />
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{
2023-11-04 08:20:02 +00:00
label: 'Documents',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-04 08:20:02 +00:00
label: 'New',
icon: 'pi pi-plus'
2023-02-28 08:29:30 +00:00
},
{
2023-11-04 08:20:02 +00:00
label: 'Search',
icon: 'pi pi-search'
}
]
},
{
label: 'Profile',
items: [
{
label: 'Settings',
icon: 'pi pi-cog'
},
{
label: 'Logout',
icon: 'pi pi-sign-out'
2023-02-28 08:29:30 +00:00
}
]
}
],
code: {
2023-09-22 12:54:14 +00:00
basic: `
<Menu :model="items" />
2023-10-15 09:38:39 +00:00
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
2023-02-28 08:29:30 +00:00
<Menu :model="items" />
</div>
</template>
<script>
export default {
data() {
return {
items: [
{
2023-11-04 08:20:02 +00:00
label: 'Documents',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-04 08:20:02 +00:00
label: 'New',
icon: 'pi pi-plus'
2023-02-28 08:29:30 +00:00
},
{
2023-11-04 08:20:02 +00:00
label: 'Search',
icon: 'pi pi-search'
}
]
},
{
label: 'Profile',
items: [
{
label: 'Settings',
icon: 'pi pi-cog'
},
{
label: 'Logout',
icon: 'pi pi-sign-out'
2023-02-28 08:29:30 +00:00
}
]
}
]
};
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
2023-02-28 08:29:30 +00:00
<Menu :model="items" />
</div>
</template>
<script setup>
import { ref } from "vue";
const items = ref([
{
2023-11-04 08:20:02 +00:00
label: 'Documents',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-04 08:20:02 +00:00
label: 'New',
icon: 'pi pi-plus'
2023-02-28 08:29:30 +00:00
},
{
2023-11-04 08:20:02 +00:00
label: 'Search',
icon: 'pi pi-search'
}
]
},
{
label: 'Profile',
items: [
{
label: 'Settings',
icon: 'pi pi-cog'
},
{
label: 'Logout',
icon: 'pi pi-sign-out'
2023-02-28 08:29:30 +00:00
}
]
}
]);
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>