mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-08 16:37:15 +00:00
toast: add remove method to clear a single message (#4101)
Co-authored-by: Clément Bernard <cbernard@groupeisagri.com>
This commit is contained in:
parent
4bcb9bd14f
commit
cee96884f9
4 changed files with 26 additions and 0 deletions
|
@ -43,6 +43,7 @@ export default {
|
|||
styleElement: null,
|
||||
mounted() {
|
||||
ToastEventBus.on('add', this.onAdd);
|
||||
ToastEventBus.on('remove', this.onRemove);
|
||||
ToastEventBus.on('remove-group', this.onRemoveGroup);
|
||||
ToastEventBus.on('remove-all-groups', this.onRemoveAllGroups);
|
||||
|
||||
|
@ -58,6 +59,7 @@ export default {
|
|||
}
|
||||
|
||||
ToastEventBus.off('add', this.onAdd);
|
||||
ToastEventBus.off('remove', this.onRemove);
|
||||
ToastEventBus.off('remove-group', this.onRemoveGroup);
|
||||
ToastEventBus.off('remove-all-groups', this.onRemoveAllGroups);
|
||||
},
|
||||
|
@ -87,6 +89,9 @@ export default {
|
|||
this.add(message);
|
||||
}
|
||||
},
|
||||
onRemove(message) {
|
||||
this.remove({ message, type: 'close' });
|
||||
},
|
||||
onRemoveGroup(group) {
|
||||
if (this.group === group) {
|
||||
this.messages = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue