From 8d2caf19dd890338e47a60494f78d95536195374 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Thu, 6 Jun 2024 14:48:40 +0300 Subject: [PATCH] Fixed #5844 - Message props default value changes --- components/lib/message/BaseMessage.vue | 8 ++------ components/lib/message/Message.d.ts | 5 +++-- components/lib/message/Message.vue | 20 +++++--------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/components/lib/message/BaseMessage.vue b/components/lib/message/BaseMessage.vue index 72670e022..99909d310 100644 --- a/components/lib/message/BaseMessage.vue +++ b/components/lib/message/BaseMessage.vue @@ -12,15 +12,11 @@ export default { }, closable: { type: Boolean, - default: true - }, - sticky: { - type: Boolean, - default: true + default: false }, life: { type: Number, - default: 3000 + default: null }, icon: { type: String, diff --git a/components/lib/message/Message.d.ts b/components/lib/message/Message.d.ts index 962503f8e..3bc7e8e66 100755 --- a/components/lib/message/Message.d.ts +++ b/components/lib/message/Message.d.ts @@ -111,17 +111,18 @@ export interface MessageProps { severity?: HintedString<'success' | 'info' | 'warn' | 'error' | 'secondary' | 'contrast'> | undefined; /** * Whether the message can be closed manually using the close icon. - * @defaultValue true + * @defaultValue false */ closable?: boolean | undefined; /** + * @deprecated since 4.0. * When enabled, message is not removed automatically. * @defaultValue true */ sticky?: boolean | undefined; /** * Delay in milliseconds to close the message automatically. - * @defaultValue 3000 + * @defaultValue null */ life?: number | undefined; /** diff --git a/components/lib/message/Message.vue b/components/lib/message/Message.vue index 82e4c404d..8c8e4f6bf 100755 --- a/components/lib/message/Message.vue +++ b/components/lib/message/Message.vue @@ -40,28 +40,18 @@ export default { visible: true }; }, - watch: { - sticky(newValue) { - if (!newValue) { - this.closeAfterDelay(); - } - } - }, mounted() { - if (!this.sticky) { - this.closeAfterDelay(); + if (this.life) { + setTimeout(() => { + this.visible = false; + this.$emit('life-end'); + }, this.life); } }, methods: { close(event) { this.visible = false; this.$emit('close', event); - }, - closeAfterDelay() { - setTimeout(() => { - this.visible = false; - this.$emit('life-end'); - }, this.life); } }, computed: {