primevue-mirror/apps/showcase/doc/contextmenu/DocumentDoc.vue

136 lines
3.2 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Setting global property attaches the context menu to the document.</p>
</DocSectionText>
<div class="card text-center">
<p class="mb-0">Right-Click anywhere on this page to view the global ContextMenu.</p>
<ContextMenu global :model="items" />
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{
2023-11-07 07:55:48 +00:00
label: 'Translate',
icon: 'pi pi-language'
2023-02-28 08:29:30 +00:00
},
{
2023-11-07 07:55:48 +00:00
label: 'Speech',
icon: 'pi pi-volume-up',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-07 07:55:48 +00:00
label: 'Start',
icon: 'pi pi-caret-right'
2023-02-28 08:29:30 +00:00
},
{
2023-11-07 07:55:48 +00:00
label: 'Stop',
icon: 'pi pi-pause'
2023-02-28 08:29:30 +00:00
}
]
},
{
separator: true
},
{
2023-11-07 07:55:48 +00:00
label: 'Print',
icon: 'pi pi-print'
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
<ContextMenu global :model="items" />
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card text-center">
<p class="mb-0">Right-Click anywhere on this page to view the global ContextMenu.</p>
<ContextMenu global :model="items" />
</div>
</template>
<script>
export default {
data() {
return {
items: [
{
2023-11-07 07:55:48 +00:00
label: 'Translate',
icon: 'pi pi-language'
2023-02-28 08:29:30 +00:00
},
{
2023-11-07 07:55:48 +00:00
label: 'Speech',
icon: 'pi pi-volume-up',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-07 07:55:48 +00:00
label: 'Start',
icon: 'pi pi-caret-right'
2023-02-28 08:29:30 +00:00
},
{
2023-11-07 07:55:48 +00:00
label: 'Stop',
icon: 'pi pi-pause'
2023-02-28 08:29:30 +00:00
}
]
},
{
separator: true
},
{
2023-11-07 07:55:48 +00:00
label: 'Print',
icon: 'pi pi-print'
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 text-center">
<p class="mb-0">Right-Click anywhere on this page to view the global ContextMenu.</p>
<ContextMenu global :model="items" />
</div>
</template>
<script setup>
import { ref } from "vue";
const items = ref([
{
2023-11-07 07:55:48 +00:00
label: 'Translate',
icon: 'pi pi-language'
2023-02-28 08:29:30 +00:00
},
{
2023-11-07 07:55:48 +00:00
label: 'Speech',
icon: 'pi pi-volume-up',
2023-02-28 08:29:30 +00:00
items: [
{
2023-11-07 07:55:48 +00:00
label: 'Start',
icon: 'pi pi-caret-right'
2023-02-28 08:29:30 +00:00
},
{
2023-11-07 07:55:48 +00:00
label: 'Stop',
icon: 'pi pi-pause'
2023-02-28 08:29:30 +00:00
}
]
},
{
separator: true
},
{
2023-11-07 07:55:48 +00:00
label: 'Print',
icon: 'pi pi-print'
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>