From 037183aa25cf48f6bf7d5b6b861311c6e76bcffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 25 Jun 2021 13:10:52 +0300 Subject: [PATCH] Fixed #1249 - Feature Request: Templating for Toast component --- src/components/toast/Toast.vue | 2 +- src/components/toast/ToastMessage.vue | 16 +++-- src/views/toast/ToastDemo.vue | 33 ++++++++++ src/views/toast/ToastDoc.vue | 92 ++++++++++++++++++++++++++- 4 files changed, 135 insertions(+), 8 deletions(-) diff --git a/src/components/toast/Toast.vue b/src/components/toast/Toast.vue index 90b88f93e..3025e0c44 100755 --- a/src/components/toast/Toast.vue +++ b/src/components/toast/Toast.vue @@ -2,7 +2,7 @@
- +
diff --git a/src/components/toast/ToastMessage.vue b/src/components/toast/ToastMessage.vue index ed1cb245a..b7c3ef8d0 100755 --- a/src/components/toast/ToastMessage.vue +++ b/src/components/toast/ToastMessage.vue @@ -1,11 +1,14 @@ @@ -351,6 +400,15 @@ export default { this.$toast.add({severity:'info', summary:'Message 2', detail:'Message 2 Content', life: 3000}); this.$toast.add({severity:'info', summary:'Message 3', detail:'Message 3 Content', life: 3000}); }, + showTemplate() { + this.$toast.add({severity: 'warn', summary: 'Are you sure?', detail: 'Proceed to confirm', group: 'bc'}); + }, + onConfirm() { + this.$toast.removeGroup('bc'); + }, + onReject() { + this.$toast.removeGroup('bc'); + }, clear() { this.$toast.removeAllGroups(); } @@ -382,6 +440,26 @@ button { + + + +
Severities
@@ -441,12 +522,21 @@ export default defineComponent({ toast.add({severity:'info', summary:'Message 2', detail:'Message 2 Content', life: 3000}); toast.add({severity:'info', summary:'Message 3', detail:'Message 3 Content', life: 3000}); } + const showTemplate = () => { + toast.add({severity: 'warn', summary: 'Are you sure?', detail: 'Proceed to confirm', group: 'bc'}); + } + const onConfirm = () => { + toast.removeGroup('bc'); + } + const onReject = () => { + toast.removeGroup('bc'); + } const clear = () => { toast.removeAllGroups(); } return { showSuccess, showInfo, showWarn, showError, showTopLeft, showBottomLeft, - showBottomRight, showSticky, showMultiple, clear }; + showBottomRight, showSticky, showMultiple, showTemplate, onConfirm, onReject, clear }; } }); <\\/script>