2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Templating allows customizing the content where the message instance is available as the implicit variable.</p>
|
|
|
|
</DocSectionText>
|
2023-09-20 08:14:24 +00:00
|
|
|
<ConfirmDialog group="templating" :pt="{ headertitle: 'mr-4' }">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #message="slotProps">
|
|
|
|
<div class="flex p-4">
|
|
|
|
<i :class="slotProps.message.icon" style="font-size: 1.5rem"></i>
|
|
|
|
<p class="pl-2">{{ slotProps.message.message }}</p>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</ConfirmDialog>
|
|
|
|
<div class="card flex flex-wrap gap-2 justify-content-center">
|
|
|
|
<Button @click="showTemplate()" icon="pi pi-check" label="Terms and Conditions" class="mr-2"></Button>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
|
|
|
<ConfirmDialog group="templating" :pt="{ headertitle: 'mr-4' }">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #message="slotProps">
|
|
|
|
<div class="flex p-4">
|
|
|
|
<i :class="slotProps.message.icon" style="font-size: 1.5rem"></i>
|
|
|
|
<p class="pl-2">{{ slotProps.message.message }}</p>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</ConfirmDialog>
|
2023-10-15 09:38:39 +00:00
|
|
|
<Button @click="showTemplate()" icon="pi pi-check" label="Terms and Conditions" class="mr-2"></Button>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2023-09-20 08:14:24 +00:00
|
|
|
<ConfirmDialog group="templating" :pt="{ headertitle: 'mr-4' }">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #message="slotProps">
|
|
|
|
<div class="flex p-4">
|
|
|
|
<i :class="slotProps.message.icon" style="font-size: 1.5rem"></i>
|
|
|
|
<p class="pl-2">{{ slotProps.message.message }}</p>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</ConfirmDialog>
|
|
|
|
<div class="card flex flex-wrap gap-2 justify-content-center">
|
|
|
|
<Button @click="showTemplate()" icon="pi pi-check" label="Terms and Conditions" class="mr-2"></Button>
|
|
|
|
</div>
|
2023-09-20 08:14:24 +00:00
|
|
|
<Toast />
|
2023-02-28 08:29:30 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
methods: {
|
|
|
|
showTemplate() {
|
|
|
|
this.$confirm.require({
|
|
|
|
group: 'templating',
|
|
|
|
header: 'Terms and Conditions',
|
|
|
|
message: 'Do you accept that?',
|
|
|
|
icon: 'pi pi-question-circle',
|
|
|
|
acceptIcon: 'pi pi-check',
|
|
|
|
rejectIcon: 'pi pi-times',
|
|
|
|
accept: () => {
|
|
|
|
this.$toast.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted', life: 3000 });
|
|
|
|
},
|
|
|
|
reject: () => {
|
|
|
|
this.$toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2023-09-20 08:14:24 +00:00
|
|
|
<ConfirmDialog group="templating" :pt="{ headertitle: 'mr-4' }">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #message="slotProps">
|
|
|
|
<div class="flex p-4">
|
|
|
|
<i :class="slotProps.message.icon" style="font-size: 1.5rem"></i>
|
|
|
|
<p class="pl-2">{{ slotProps.message.message }}</p>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</ConfirmDialog>
|
|
|
|
<div class="card flex flex-wrap gap-2 justify-content-center">
|
|
|
|
<Button @click="showTemplate()" icon="pi pi-check" label="Terms and Conditions" class="mr-2"></Button>
|
|
|
|
</div>
|
2023-09-20 08:14:24 +00:00
|
|
|
<Toast />
|
2023-02-28 08:29:30 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { useConfirm } from "primevue/useconfirm";
|
|
|
|
import { useToast } from "primevue/usetoast";
|
|
|
|
|
|
|
|
const confirm = useConfirm();
|
|
|
|
const toast = useToast();
|
|
|
|
|
|
|
|
const showTemplate = () => {
|
|
|
|
confirm.require({
|
|
|
|
group: 'templating',
|
|
|
|
header: 'Terms and Conditions',
|
|
|
|
message: 'Do you accept that?',
|
|
|
|
icon: 'pi pi-question-circle',
|
|
|
|
acceptIcon: 'pi pi-check',
|
|
|
|
rejectIcon: 'pi pi-times',
|
|
|
|
accept: () => {
|
|
|
|
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted', life: 3000 });
|
|
|
|
},
|
|
|
|
reject: () => {
|
|
|
|
toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
showTemplate() {
|
|
|
|
this.$confirm.require({
|
|
|
|
group: 'templating',
|
|
|
|
header: 'Terms and Conditions',
|
|
|
|
message: 'Do you accept that?',
|
|
|
|
icon: 'pi pi-question-circle',
|
|
|
|
acceptIcon: 'pi pi-check',
|
|
|
|
rejectIcon: 'pi pi-times',
|
|
|
|
accept: () => {
|
|
|
|
this.$toast.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted', life: 3000 });
|
|
|
|
},
|
|
|
|
reject: () => {
|
|
|
|
this.$toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|