2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Custom content inside a message is defined with the <i>content</i> option.</p>
|
|
|
|
</DocSectionText>
|
|
|
|
<div class="card flex justify-content-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">
|
|
|
|
<div class="flex flex-column align-items-center" style="flex: 1">
|
|
|
|
<div class="text-center">
|
|
|
|
<i class="pi pi-exclamation-triangle" style="font-size: 3rem"></i>
|
2023-03-07 12:50:28 +00:00
|
|
|
<div class="font-bold text-xl my-3">{{ slotProps.message.summary }}</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
<div class="flex gap-2">
|
2023-03-03 12:15:20 +00:00
|
|
|
<Button severity="success" label="Yes" @click="onConfirm()"></Button>
|
|
|
|
<Button severity="secondary" label="No" @click="onReject()"></Button>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Toast>
|
|
|
|
<Button @click="showTemplate" label="Confirm" />
|
|
|
|
</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">
|
|
|
|
<div class="flex flex-column align-items-center" style="flex: 1">
|
|
|
|
<div class="text-center">
|
|
|
|
<i class="pi pi-exclamation-triangle" style="font-size: 3rem"></i>
|
2023-03-07 12:50:28 +00:00
|
|
|
<div class="font-bold text-xl my-3">{{ slotProps.message.summary }}</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
<div class="flex gap-2">
|
2023-03-03 12:15:20 +00:00
|
|
|
<Button severity="success" label="Yes" @click="onConfirm()"></Button>
|
|
|
|
<Button severity="secondary" label="No" @click="onReject()"></Button>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Toast>
|
|
|
|
<Button @click="showTemplate" label="Confirm" />`,
|
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-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">
|
|
|
|
<div class="flex flex-column align-items-center" style="flex: 1">
|
|
|
|
<div class="text-center">
|
|
|
|
<i class="pi pi-exclamation-triangle" style="font-size: 3rem"></i>
|
2023-03-07 12:50:28 +00:00
|
|
|
<div class="font-bold text-xl my-3">{{ slotProps.message.summary }}</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
<div class="flex gap-2">
|
2023-03-03 12:15:20 +00:00
|
|
|
<Button severity="success" label="Yes" @click="onConfirm()"></Button>
|
|
|
|
<Button severity="secondary" label="No" @click="onReject()"></Button>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Toast>
|
|
|
|
<Button @click="showTemplate" label="Confirm" />
|
|
|
|
</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) {
|
|
|
|
this.$toast.add({ severity: 'warn', summary: 'Are you sure?', detail: 'Proceed to confirm', group: 'bc' });
|
|
|
|
this.visible = true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onConfirm() {
|
|
|
|
this.$toast.removeGroup('bc');
|
|
|
|
this.visible = false;
|
|
|
|
},
|
|
|
|
onReject() {
|
|
|
|
this.$toast.removeGroup('bc');
|
|
|
|
this.visible = false;
|
|
|
|
},
|
|
|
|
onClose() {
|
|
|
|
this.visible = false;
|
2023-02-28 08:29:30 +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-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">
|
|
|
|
<div class="flex flex-column align-items-center" style="flex: 1">
|
|
|
|
<div class="text-center">
|
|
|
|
<i class="pi pi-exclamation-triangle" style="font-size: 3rem"></i>
|
2023-03-07 12:50:28 +00:00
|
|
|
<div class="font-bold text-xl my-3">{{ slotProps.message.summary }}</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
<div class="flex gap-2">
|
2023-03-03 12:15:20 +00:00
|
|
|
<Button severity="success" label="Yes" @click="onConfirm()"></Button>
|
|
|
|
<Button severity="secondary" label="No" @click="onReject()"></Button>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Toast>
|
|
|
|
<Button @click="showTemplate" label="Confirm" />
|
|
|
|
</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) {
|
|
|
|
toast.add({ severity: 'warn', summary: 'Are you sure?', detail: 'Proceed to confirm', group: 'bc' });
|
|
|
|
visible.value = true;
|
|
|
|
}
|
2023-02-28 08:29:30 +00:00
|
|
|
};
|
2023-10-07 10:06:54 +00:00
|
|
|
|
|
|
|
const onConfirm = () => {
|
|
|
|
toast.removeGroup('bc');
|
|
|
|
visible.value = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const onReject = () => {
|
|
|
|
toast.removeGroup('bc');
|
|
|
|
visible.value = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const onClose = () => {
|
|
|
|
visible.value = false;
|
|
|
|
}
|
2023-02-28 08:29:30 +00:00
|
|
|
<\/script>`
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
showTemplate() {
|
2023-10-07 10:06:54 +00:00
|
|
|
if (!this.visible) {
|
|
|
|
this.$toast.add({ severity: 'warn', summary: 'Are you sure?', detail: 'Proceed to confirm', group: 'bc' });
|
|
|
|
this.visible = true;
|
|
|
|
}
|
2023-02-28 08:29:30 +00:00
|
|
|
},
|
|
|
|
onConfirm() {
|
|
|
|
this.$toast.removeGroup('bc');
|
2023-10-07 10:06:54 +00:00
|
|
|
this.visible = false;
|
2023-02-28 08:29:30 +00:00
|
|
|
},
|
|
|
|
onReject() {
|
|
|
|
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>
|