primevue-mirror/doc/panel/TemplateDoc.vue

222 lines
8.3 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
2023-10-23 12:20:11 +00:00
<p>Header, icons and footer sections of the panel are customizable via templating.</p>
2023-02-28 08:29:30 +00:00
</DocSectionText>
<div class="card">
2023-10-23 12:18:43 +00:00
<Panel toggleable>
<template #header>
<div class="flex align-items-center gap-2">
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" size="large" shape="circle" />
<span class="font-bold">Amy Elsner</span>
</div>
</template>
<template #footer>
<div class="flex align-items-center justify-content-between">
<div class="flex align-items-center gap-2">
<Button icon="pi pi-user" rounded text></Button>
<Button icon="pi pi-bookmark" severity="secondary" rounded text></Button>
</div>
<span class="p-text-secondary">Last updated 2 hours ago</span>
</div>
</template>
2023-02-28 08:29:30 +00:00
<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>
2023-03-02 13:38:18 +00:00
<p class="m-0">
2023-02-28 08:29:30 +00:00
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: [
{
2023-10-23 12:18:43 +00:00
label: 'Refresh',
icon: 'pi pi-refresh'
},
{
label: 'Search',
icon: 'pi pi-search'
2023-02-28 08:29:30 +00:00
},
{
2023-10-23 12:18:43 +00:00
separator: true
},
{
label: 'Delete',
icon: 'pi pi-times'
2023-02-28 08:29:30 +00:00
}
],
code: {
2023-09-22 12:54:14 +00:00
basic: `
2023-10-23 12:18:43 +00:00
<Panel toggleable>
<template #header>
<div class="flex align-items-center gap-2">
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" size="large" shape="circle" />
<span class="font-bold">Amy Elsner</span>
</div>
</template>
<template #footer>
<div class="flex align-items-center justify-content-between">
<div class="flex align-items-center gap-2">
<Button icon="pi pi-user" rounded text></Button>
<Button icon="pi pi-bookmark" severity="secondary" rounded text></Button>
</div>
<span class="p-text-secondary">Last updated 2 hours ago</span>
</div>
2023-02-28 08:29:30 +00:00
</template>
2023-03-02 13:38:18 +00:00
<p class="m-0">
2023-02-28 08:29:30 +00:00
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>
2023-10-15 09:38:39 +00:00
</Panel>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
<Toast />
2023-10-23 12:18:43 +00:00
<Panel toggleable>
<template #header>
<div class="flex align-items-center gap-2">
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" size="large" shape="circle" />
<span class="font-bold">Amy Elsner</span>
</div>
</template>
<template #footer>
<div class="flex align-items-center justify-content-between">
<div class="flex align-items-center gap-2">
<Button icon="pi pi-user" rounded text></Button>
<Button icon="pi pi-bookmark" severity="secondary" rounded text></Button>
</div>
<span class="p-text-secondary">Last updated 2 hours ago</span>
</div>
2023-02-28 08:29:30 +00:00
</template>
2023-03-02 13:38:18 +00:00
<p class="m-0">
2023-02-28 08:29:30 +00:00
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: [
{
2023-10-23 12:18:43 +00:00
label: 'Refresh',
icon: 'pi pi-refresh'
},
{
label: 'Search',
icon: 'pi pi-search'
2023-02-28 08:29:30 +00:00
},
{
2023-10-23 12:18:43 +00:00
separator: true
},
{
label: 'Delete',
icon: 'pi pi-times'
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 });
}
}
}
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">
<Toast />
2023-10-23 12:18:43 +00:00
<Panel toggleable>
<template #header>
<div class="flex align-items-center gap-2">
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" size="large" shape="circle" />
<span class="font-bold">Amy Elsner</span>
</div>
</template>
<template #footer>
<div class="flex align-items-center justify-content-between">
<div class="flex align-items-center gap-2">
<Button icon="pi pi-user" rounded text></Button>
<Button icon="pi pi-bookmark" severity="secondary" rounded text></Button>
</div>
<span class="p-text-secondary">Last updated 2 hours ago</span>
</div>
2023-02-28 08:29:30 +00:00
</template>
2023-03-02 13:38:18 +00:00
<p class="m-0">
2023-02-28 08:29:30 +00:00
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([
{
2023-10-23 12:18:43 +00:00
label: 'Refresh',
icon: 'pi pi-refresh'
2023-02-28 08:29:30 +00:00
},
{
2023-10-23 12:18:43 +00:00
label: 'Search',
icon: 'pi pi-search'
},
{
separator: true
},
{
label: 'Delete',
icon: 'pi pi-times'
2023-02-28 08:29:30 +00:00
}
]);
const toggle = (event) => {
menu.value.toggle(event);
};
const save = () => {
toast.add({ severity: 'success', summary: 'Success', detail: 'Data Saved', life: 3000 });
};
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>