diff --git a/api-generator/components/message.js b/api-generator/components/message.js index 68f553418..f78755ec8 100644 --- a/api-generator/components/message.js +++ b/api-generator/components/message.js @@ -75,6 +75,10 @@ const MessageEvents = [ description: 'Browser event' } ] + }, + { + name: 'life-end', + description: "Callback to invoke when the message's timeout is over." } ]; diff --git a/components/lib/message/Message.d.ts b/components/lib/message/Message.d.ts index 52474fdff..a4aeb713e 100755 --- a/components/lib/message/Message.d.ts +++ b/components/lib/message/Message.d.ts @@ -218,6 +218,10 @@ export interface MessageEmits { * @param {Event} event - Browser event. */ close(event: Event): void; + /** + * Callback to invoke when the message's timeout is over. + */ + 'life-end'(): void; } /** diff --git a/components/lib/message/Message.vue b/components/lib/message/Message.vue index e698a2201..9c883773d 100755 --- a/components/lib/message/Message.vue +++ b/components/lib/message/Message.vue @@ -32,7 +32,7 @@ import BaseMessage from './BaseMessage.vue'; export default { name: 'Message', extends: BaseMessage, - emits: ['close'], + emits: ['close', 'life-end'], timeout: null, data() { return { @@ -59,6 +59,7 @@ export default { closeAfterDelay() { setTimeout(() => { this.visible = false; + this.$emit('life-end'); }, this.life); } },