237 lines
8.5 KiB
Vue
237 lines
8.5 KiB
Vue
<template>
|
|
<DocSectionText v-bind="$attrs">
|
|
<p>Header of the panel is either defined with the header property or the header template.</p>
|
|
</DocSectionText>
|
|
<div class="card">
|
|
<Panel header="Header" toggleable>
|
|
<template #icons>
|
|
<button class="p-panel-header-icon p-link mr-2" @click="toggle">
|
|
<span class="pi pi-cog"></span>
|
|
</button>
|
|
<Menu ref="menu" id="config_menu" :model="items" popup />
|
|
</template>
|
|
<p class="m-0">
|
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
</p>
|
|
</Panel>
|
|
</div>
|
|
<DocSectionCode :code="code" />
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
items: [
|
|
{
|
|
label: 'Options',
|
|
items: [
|
|
{
|
|
label: 'Update',
|
|
icon: 'pi pi-refresh',
|
|
command: () => {
|
|
this.$toast.add({ severity: 'success', summary: 'Updated', detail: 'Data Updated', life: 3000 });
|
|
}
|
|
},
|
|
{
|
|
label: 'Delete',
|
|
icon: 'pi pi-times',
|
|
command: () => {
|
|
this.$toast.add({ severity: 'warn', summary: 'Delete', detail: 'Data Deleted', life: 3000 });
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: 'Navigate',
|
|
items: [
|
|
{
|
|
label: 'Vue Website',
|
|
icon: 'pi pi-external-link',
|
|
url: 'https://vuejs.org/'
|
|
},
|
|
{
|
|
label: 'Router',
|
|
icon: 'pi pi-upload',
|
|
to: '/fileupload'
|
|
}
|
|
]
|
|
}
|
|
],
|
|
code: {
|
|
basic: `
|
|
<Panel header="Header" toggleable>
|
|
<template #icons>
|
|
<button class="p-panel-header-icon p-link mr-2" @click="toggle">
|
|
<span class="pi pi-cog"></span>
|
|
</button>
|
|
<Menu ref="menu" id="config_menu" :model="items" popup />
|
|
</template>
|
|
<p class="m-0">
|
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
</p>
|
|
</Panel>
|
|
`,
|
|
options: `
|
|
<template>
|
|
<div class="card">
|
|
<Toast />
|
|
<Panel header="Header" toggleable>
|
|
<template #icons>
|
|
<button class="p-panel-header-icon p-link mr-2" @click="toggle">
|
|
<span class="pi pi-cog"></span>
|
|
</button>
|
|
<Menu ref="menu" id="config_menu" :model="items" popup />
|
|
</template>
|
|
<p class="m-0">
|
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
</p>
|
|
</Panel>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
items: [
|
|
{
|
|
label: 'Options',
|
|
items: [
|
|
{
|
|
label: 'Update',
|
|
icon: 'pi pi-refresh',
|
|
command: () => {
|
|
this.$toast.add({ severity: 'success', summary: 'Updated', detail: 'Data Updated', life: 3000 });
|
|
}
|
|
},
|
|
{
|
|
label: 'Delete',
|
|
icon: 'pi pi-times',
|
|
command: () => {
|
|
this.$toast.add({ severity: 'warn', summary: 'Delete', detail: 'Data Deleted', life: 3000 });
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: 'Navigate',
|
|
items: [
|
|
{
|
|
label: 'Vue Website',
|
|
icon: 'pi pi-external-link',
|
|
url: 'https://vuejs.org/'
|
|
},
|
|
{
|
|
label: 'Router',
|
|
icon: 'pi pi-upload',
|
|
to: '/fileupload'
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
methods: {
|
|
toggle(event) {
|
|
this.$refs.menu.toggle(event);
|
|
},
|
|
save() {
|
|
this.$toast.add({ severity: 'success', summary: 'Success', detail: 'Data Saved', life: 3000 });
|
|
}
|
|
}
|
|
}
|
|
<\/script>
|
|
`,
|
|
composition: `
|
|
<template>
|
|
<div class="card">
|
|
<Toast />
|
|
<Panel header="Header" toggleable>
|
|
<template #icons>
|
|
<button class="p-panel-header-icon p-link mr-2" @click="toggle">
|
|
<span class="pi pi-cog"></span>
|
|
</button>
|
|
<Menu ref="menu" id="config_menu" :model="items" popup />
|
|
</template>
|
|
<p class="m-0">
|
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
</p>
|
|
</Panel>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from 'vue';
|
|
import { useToast } from "primevue/usetoast";
|
|
import { useRouter } from 'vue-router';
|
|
import Menu from 'primevue/menu';
|
|
|
|
const menu = ref(null);
|
|
const toast = useToast();
|
|
const router = useRouter();
|
|
|
|
const items = ref([
|
|
{
|
|
label: 'Options',
|
|
items: [
|
|
{
|
|
label: 'Update',
|
|
icon: 'pi pi-refresh',
|
|
command: () => {
|
|
toast.add({ severity: 'success', summary: 'Updated', detail: 'Data Updated', life: 3000 });
|
|
}
|
|
},
|
|
{
|
|
label: 'Delete',
|
|
icon: 'pi pi-times',
|
|
command: () => {
|
|
toast.add({ severity: 'warn', summary: 'Delete', detail: 'Data Deleted', life: 3000 });
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: 'Navigate',
|
|
items: [
|
|
{
|
|
label: 'Vue Website',
|
|
icon: 'pi pi-external-link',
|
|
url: 'https://vuejs.org/'
|
|
},
|
|
{
|
|
label: 'Router',
|
|
icon: 'pi pi-upload',
|
|
to: '/fileupload'
|
|
}
|
|
]
|
|
}
|
|
]);
|
|
|
|
const toggle = (event) => {
|
|
menu.value.toggle(event);
|
|
};
|
|
|
|
const save = () => {
|
|
toast.add({ severity: 'success', summary: 'Success', detail: 'Data Saved', life: 3000 });
|
|
};
|
|
<\/script>
|
|
`
|
|
}
|
|
};
|
|
},
|
|
methods: {
|
|
toggle(event) {
|
|
this.$refs.menu.toggle(event);
|
|
},
|
|
save() {
|
|
this.$toast.add({ severity: 'success', summary: 'Success', detail: 'Data Saved', life: 3000 });
|
|
}
|
|
}
|
|
};
|
|
</script>
|