Fixed #5070 - Message: 'life-end' emit

pull/5098/head^2
tugcekucukoglu 2024-01-18 09:44:22 +03:00
parent 9a27f6b16b
commit 1a1b60c443
3 changed files with 10 additions and 1 deletions

View File

@ -75,6 +75,10 @@ const MessageEvents = [
description: 'Browser event' description: 'Browser event'
} }
] ]
},
{
name: 'life-end',
description: "Callback to invoke when the message's timeout is over."
} }
]; ];

View File

@ -218,6 +218,10 @@ export interface MessageEmits {
* @param {Event} event - Browser event. * @param {Event} event - Browser event.
*/ */
close(event: Event): void; close(event: Event): void;
/**
* Callback to invoke when the message's timeout is over.
*/
'life-end'(): void;
} }
/** /**

View File

@ -32,7 +32,7 @@ import BaseMessage from './BaseMessage.vue';
export default { export default {
name: 'Message', name: 'Message',
extends: BaseMessage, extends: BaseMessage,
emits: ['close'], emits: ['close', 'life-end'],
timeout: null, timeout: null,
data() { data() {
return { return {
@ -59,6 +59,7 @@ export default {
closeAfterDelay() { closeAfterDelay() {
setTimeout(() => { setTimeout(() => {
this.visible = false; this.visible = false;
this.$emit('life-end');
}, this.life); }, this.life);
} }
}, },