primevue-mirror/doc/tieredmenu/BasicDoc.vue

259 lines
7.0 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>TieredMenu requires a collection of menuitems as its <i>model</i>.</p>
</DocSectionText>
<div class="card flex justify-content-center">
<TieredMenu :model="items" />
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'File',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-file',
2023-02-28 08:29:30 +00:00
items: [
{
label: 'New',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-plus',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-06 15:14:05 +00:00
label: 'Document',
icon: 'pi pi-file'
},
{
label: 'Image',
icon: 'pi pi-image'
2023-02-28 08:29:30 +00:00
},
{
label: 'Video',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-video'
2023-02-28 08:29:30 +00:00
}
]
},
{
2023-11-06 15:14:05 +00:00
label: 'Open',
icon: 'pi pi-folder-open'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Print',
icon: 'pi pi-print'
2023-02-28 08:29:30 +00:00
}
]
},
{
label: 'Edit',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-file-edit',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-06 15:14:05 +00:00
label: 'Copy',
icon: 'pi pi-copy'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Delete',
icon: 'pi pi-times'
2023-02-28 08:29:30 +00:00
}
]
},
{
2023-11-06 15:14:05 +00:00
label: 'Search',
icon: 'pi pi-search'
},
{
separator: true
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Share',
icon: 'pi pi-share-alt',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-06 15:14:05 +00:00
label: 'Slack',
icon: 'pi pi-slack'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Whatsapp',
icon: 'pi pi-whatsapp'
2023-02-28 08:29:30 +00:00
}
]
}
],
code: {
2023-09-22 12:54:14 +00:00
basic: `
2023-10-15 09:38:39 +00:00
<TieredMenu :model="items" />
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card flex justify-content-center">
<TieredMenu :model="items" />
</div>
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'File',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-file',
2023-02-28 08:29:30 +00:00
items: [
{
label: 'New',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-plus',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-06 15:14:05 +00:00
label: 'Document',
icon: 'pi pi-file'
},
{
label: 'Image',
icon: 'pi pi-image'
2023-02-28 08:29:30 +00:00
},
{
label: 'Video',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-video'
2023-02-28 08:29:30 +00:00
}
]
},
{
2023-11-06 15:14:05 +00:00
label: 'Open',
icon: 'pi pi-folder-open'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Print',
icon: 'pi pi-print'
2023-02-28 08:29:30 +00:00
}
]
},
{
label: 'Edit',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-file-edit',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-06 15:14:05 +00:00
label: 'Copy',
icon: 'pi pi-copy'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Delete',
icon: 'pi pi-times'
2023-02-28 08:29:30 +00:00
}
]
},
{
2023-11-06 15:14:05 +00:00
label: 'Search',
icon: 'pi pi-search'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
separator: true
},
{
label: 'Share',
icon: 'pi pi-share-alt',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-06 15:14:05 +00:00
label: 'Slack',
icon: 'pi pi-slack'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Whatsapp',
icon: 'pi pi-whatsapp'
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>
2023-02-28 08:29:30 +00:00
<div class="card flex justify-content-center">
<TieredMenu :model="items" />
</div>
</template>
<script setup>
import { ref } from "vue";
2023-10-30 10:43:15 +00:00
2023-02-28 08:29:30 +00:00
const items = ref([
{
label: 'File',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-file',
2023-02-28 08:29:30 +00:00
items: [
{
label: 'New',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-plus',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-06 15:14:05 +00:00
label: 'Document',
icon: 'pi pi-file'
},
{
label: 'Image',
icon: 'pi pi-image'
2023-02-28 08:29:30 +00:00
},
{
label: 'Video',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-video'
2023-02-28 08:29:30 +00:00
}
]
},
{
2023-11-06 15:14:05 +00:00
label: 'Open',
icon: 'pi pi-folder-open'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Print',
icon: 'pi pi-print'
2023-02-28 08:29:30 +00:00
}
]
},
{
label: 'Edit',
2023-11-06 15:14:05 +00:00
icon: 'pi pi-file-edit',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-06 15:14:05 +00:00
label: 'Copy',
icon: 'pi pi-copy'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Delete',
icon: 'pi pi-times'
2023-02-28 08:29:30 +00:00
}
]
},
{
2023-11-06 15:14:05 +00:00
label: 'Search',
icon: 'pi pi-search'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
separator: true
},
{
label: 'Share',
icon: 'pi pi-share-alt',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-06 15:14:05 +00:00
label: 'Slack',
icon: 'pi pi-slack'
2023-02-28 08:29:30 +00:00
},
{
2023-11-06 15:14:05 +00:00
label: 'Whatsapp',
icon: 'pi pi-whatsapp'
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>