2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
2024-05-26 08:54:50 +00:00
|
|
|
<p>Custom content inside a message is defined with the <i>message</i> template.</p>
|
2023-02-28 08:29:30 +00:00
|
|
|
</DocSectionText>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
2023-10-07 10:06:54 +00:00
|
|
|
<Toast position="bottom-center" group="bc" @close="onClose">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #message="slotProps">
|
2024-05-26 08:54:50 +00:00
|
|
|
<div class="flex flex-col items-start flex-auto">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center gap-2">
|
2023-10-25 15:22:15 +00:00
|
|
|
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
|
2024-05-26 08:54:50 +00:00
|
|
|
<span class="font-bold">Amy Elsner</span>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
2024-05-26 08:54:50 +00:00
|
|
|
<div class="font-medium text-lg my-4">{{ slotProps.message.summary }}</div>
|
|
|
|
<Button size="small" label="Reply" severity="success" @click="onReply()"></Button>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Toast>
|
2023-10-25 15:22:15 +00:00
|
|
|
<Button @click="showTemplate" label="View" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2023-10-07 10:06:54 +00:00
|
|
|
visible: false,
|
2023-02-28 08:29:30 +00:00
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
2023-10-07 10:06:54 +00:00
|
|
|
<Toast position="bottom-center" group="bc" @close="onClose">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #message="slotProps">
|
2024-05-26 08:54:50 +00:00
|
|
|
<div class="flex flex-col items-start flex-auto">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center gap-2">
|
2024-05-26 08:54:50 +00:00
|
|
|
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
|
|
|
|
<span class="font-bold">Amy Elsner</span>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
2024-05-26 08:54:50 +00:00
|
|
|
<div class="font-medium text-lg my-4">{{ slotProps.message.summary }}</div>
|
|
|
|
<Button size="small" label="Reply" severity="success" @click="onReply()"></Button>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Toast>
|
2023-10-25 15:22:15 +00:00
|
|
|
<Button @click="showTemplate" label="View" />
|
2023-10-15 09:38:39 +00:00
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
2023-10-07 10:06:54 +00:00
|
|
|
<Toast position="bottom-center" group="bc" @close="onClose">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #message="slotProps">
|
2024-05-26 08:54:50 +00:00
|
|
|
<div class="flex flex-col items-start flex-auto">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center gap-2">
|
2023-10-25 15:22:15 +00:00
|
|
|
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
|
2024-05-26 08:54:50 +00:00
|
|
|
<span class="font-bold">Amy Elsner</span>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
2024-05-26 08:54:50 +00:00
|
|
|
<div class="font-medium text-lg my-4">{{ slotProps.message.summary }}</div>
|
|
|
|
<Button size="small" label="Reply" severity="success" @click="onReply()"></Button>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Toast>
|
2023-10-25 15:22:15 +00:00
|
|
|
<Button @click="showTemplate" label="View" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2023-10-07 10:06:54 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
},
|
2023-02-28 08:29:30 +00:00
|
|
|
methods: {
|
|
|
|
showTemplate() {
|
2023-10-07 10:06:54 +00:00
|
|
|
if (!this.visible) {
|
2023-10-25 15:22:15 +00:00
|
|
|
this.$toast.add({ severity: 'success', summary: 'Can you send me the report?', group: 'bc' });
|
2023-10-07 10:06:54 +00:00
|
|
|
this.visible = true;
|
|
|
|
}
|
|
|
|
},
|
2023-10-25 15:22:15 +00:00
|
|
|
onReply() {
|
2023-10-07 10:06:54 +00:00
|
|
|
this.$toast.removeGroup('bc');
|
|
|
|
this.visible = false;
|
|
|
|
},
|
|
|
|
onClose() {
|
|
|
|
this.visible = false;
|
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>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
2023-10-07 10:06:54 +00:00
|
|
|
<Toast position="bottom-center" group="bc" @close="onClose">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #message="slotProps">
|
2024-05-26 08:54:50 +00:00
|
|
|
<div class="flex flex-col items-start flex-auto">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center gap-2">
|
2023-10-25 15:22:15 +00:00
|
|
|
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
|
2024-05-26 08:54:50 +00:00
|
|
|
<span class="font-bold">Amy Elsner</span>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
2024-05-26 08:54:50 +00:00
|
|
|
<div class="font-medium text-lg my-4">{{ slotProps.message.summary }}</div>
|
|
|
|
<Button size="small" label="Reply" severity="success" @click="onReply()"></Button>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Toast>
|
2023-10-25 15:22:15 +00:00
|
|
|
<Button @click="showTemplate" label="View" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { useToast } from "primevue/usetoast";
|
2023-10-07 10:06:54 +00:00
|
|
|
import { ref } from 'vue';
|
2023-02-28 08:29:30 +00:00
|
|
|
const toast = useToast();
|
2023-10-07 10:06:54 +00:00
|
|
|
const visible = ref(false);
|
2023-02-28 08:29:30 +00:00
|
|
|
|
|
|
|
const showTemplate = () => {
|
2023-10-07 10:06:54 +00:00
|
|
|
if (!visible.value) {
|
2023-10-25 15:22:15 +00:00
|
|
|
toast.add({ severity: 'success', summary: 'Can you send me the report?', group: 'bc' });
|
2023-10-07 10:06:54 +00:00
|
|
|
visible.value = true;
|
|
|
|
}
|
2023-02-28 08:29:30 +00:00
|
|
|
};
|
2023-10-07 10:06:54 +00:00
|
|
|
|
2023-10-25 15:22:15 +00:00
|
|
|
const onReply = () => {
|
2023-10-07 10:06:54 +00:00
|
|
|
toast.removeGroup('bc');
|
|
|
|
visible.value = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const onClose = () => {
|
|
|
|
visible.value = false;
|
|
|
|
}
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
showTemplate() {
|
2023-10-07 10:06:54 +00:00
|
|
|
if (!this.visible) {
|
2023-10-25 15:22:15 +00:00
|
|
|
this.$toast.add({ severity: 'success', summary: 'Can you send me the report?', group: 'bc' });
|
2023-10-07 10:06:54 +00:00
|
|
|
this.visible = true;
|
|
|
|
}
|
2023-02-28 08:29:30 +00:00
|
|
|
},
|
2023-10-25 15:22:15 +00:00
|
|
|
onReply() {
|
2023-02-28 08:29:30 +00:00
|
|
|
this.$toast.removeGroup('bc');
|
2023-10-07 10:06:54 +00:00
|
|
|
this.visible = false;
|
|
|
|
},
|
|
|
|
onClose() {
|
|
|
|
this.visible = false;
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|