2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
2023-11-04 08:20:02 +00:00
|
|
|
<p>Overlay mode is enabled by adding <i>popup</i> property and calling <i>toggle</i> function of the menu ref with an event of the target.</p>
|
2023-02-28 08:29:30 +00:00
|
|
|
</DocSectionText>
|
|
|
|
<div class="card flex justify-content-center">
|
2023-11-04 08:20:02 +00:00
|
|
|
<Button type="button" icon="pi pi-ellipsis-v" plain @click="toggle" aria-haspopup="true" aria-controls="overlay_menu" />
|
2023-02-28 08:29:30 +00:00
|
|
|
<Menu ref="menu" id="overlay_menu" :model="items" :popup="true" />
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
label: 'Options',
|
|
|
|
items: [
|
|
|
|
{
|
2023-11-04 08:20:02 +00:00
|
|
|
label: 'Refresh',
|
|
|
|
icon: 'pi pi-refresh'
|
2023-02-28 08:29:30 +00:00
|
|
|
},
|
|
|
|
{
|
2023-11-04 08:20:02 +00:00
|
|
|
label: 'Export',
|
|
|
|
icon: 'pi pi-upload'
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
2023-11-04 08:20:02 +00:00
|
|
|
<Button type="button" icon="pi pi-ellipsis-v" @click="toggle" aria-haspopup="true" aria-controls="overlay_menu" />
|
2023-02-28 08:29:30 +00:00
|
|
|
<Menu ref="menu" id="overlay_menu" :model="items" :popup="true" />
|
2023-10-15 09:38:39 +00:00
|
|
|
`,
|
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">
|
2023-11-04 08:20:02 +00:00
|
|
|
<Button type="button" icon="pi pi-ellipsis-v" @click="toggle" aria-haspopup="true" aria-controls="overlay_menu" />
|
2023-02-28 08:29:30 +00:00
|
|
|
<Menu ref="menu" id="overlay_menu" :model="items" :popup="true" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
items: [
|
|
|
|
{
|
2023-11-04 08:20:02 +00:00
|
|
|
label: 'Refresh',
|
|
|
|
icon: 'pi pi-refresh'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Export',
|
|
|
|
icon: 'pi pi-upload'
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggle(event) {
|
|
|
|
this.$refs.menu.toggle(event);
|
|
|
|
}
|
2023-11-04 08:20:02 +00:00
|
|
|
}
|
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">
|
2023-11-04 08:20:02 +00:00
|
|
|
<Button type="button" icon="pi pi-ellipsis-v" @click="toggle" aria-haspopup="true" aria-controls="overlay_menu" />
|
2023-02-28 08:29:30 +00:00
|
|
|
<Menu ref="menu" id="overlay_menu" :model="items" :popup="true" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref } from "vue";
|
|
|
|
|
|
|
|
const menu = ref();
|
|
|
|
const items = ref([
|
|
|
|
{
|
|
|
|
label: 'Options',
|
|
|
|
items: [
|
|
|
|
{
|
2023-11-04 08:20:02 +00:00
|
|
|
label: 'Refresh',
|
|
|
|
icon: 'pi pi-refresh'
|
2023-02-28 08:29:30 +00:00
|
|
|
},
|
|
|
|
{
|
2023-11-04 08:20:02 +00:00
|
|
|
label: 'Export',
|
|
|
|
icon: 'pi pi-upload'
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
const toggle = (event) => {
|
|
|
|
menu.value.toggle(event);
|
|
|
|
};
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggle(event) {
|
|
|
|
this.$refs.menu.toggle(event);
|
|
|
|
},
|
|
|
|
save() {
|
|
|
|
this.$toast.add({ severity: 'success', summary: 'Success', detail: 'Data Saved', life: 3000 });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|