Fixed #5070 - Message: 'life-end' emit
parent
9a27f6b16b
commit
1a1b60c443
|
@ -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."
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue