From 2148d333cda327c77e6b55e3835904d22a8aec32 Mon Sep 17 00:00:00 2001 From: novlan1 <1576271227@qq.com> Date: Fri, 12 Jun 2026 19:30:45 +0800 Subject: [PATCH 01/11] =?UTF-8?q?fix(message):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=BF=9E=E7=BB=AD=E7=82=B9=E5=87=BB=E6=97=B6=E7=9A=84=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message-item/message-item.vue | 10 ++- .../uniapp-components/message/message.vue | 84 +++++++++++++++---- 2 files changed, 75 insertions(+), 19 deletions(-) diff --git a/packages/uniapp-components/message-item/message-item.vue b/packages/uniapp-components/message-item/message-item.vue index fbac4de06..de838a648 100644 --- a/packages/uniapp-components/message-item/message-item.vue +++ b/packages/uniapp-components/message-item/message-item.vue @@ -120,6 +120,7 @@ const rawData = { fadeClass: '', closeTimeoutContext: 0, + hideTimeoutContext: 0, nextAnimationContext: 0, resetAnimation: uni.createAnimation({ duration: 0, @@ -328,9 +329,10 @@ export default { this.reset(); this.fadeClass = `${name}__fade`; - setTimeout(() => { + this.hideTimeoutContext = setTimeout(() => { this.visible = false; this.animation = []; + this.hideTimeoutContext = 0; }, SHOW_DURATION); if (typeof this.onHide === 'function') { this.onHide(); @@ -344,6 +346,12 @@ export default { } clearTimeout(this.closeTimeoutContext); this.closeTimeoutContext = 0; + // 同时清掉上一次 hide 中用于延迟将 visible 置 false 的定时器, + // 避免连续快速调用 hide 后又调 show 时,旧的 timeout 把新消息 hide 掉。 + if (this.hideTimeoutContext) { + clearTimeout(this.hideTimeoutContext); + this.hideTimeoutContext = 0; + } }, handleClose() { diff --git a/packages/uniapp-components/message/message.vue b/packages/uniapp-components/message/message.vue index 348300ebc..3cc2ee6f1 100644 --- a/packages/uniapp-components/message/message.vue +++ b/packages/uniapp-components/message/message.vue @@ -1,30 +1,43 @@