From f67af0614ac6f74e43b1f548302190869f81a3be Mon Sep 17 00:00:00 2001 From: Yao Date: Fri, 23 Mar 2018 10:33:44 +0800 Subject: [PATCH] =?UTF-8?q?[bugfix]=20NoticeBar:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E6=92=AD=E6=94=BE=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#155)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复 NoticeBar 展示问题 * remove console.log --- packages/noticebar/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/noticebar/index.js b/packages/noticebar/index.js index 837620c4..b71a37e9 100644 --- a/packages/noticebar/index.js +++ b/packages/noticebar/index.js @@ -28,6 +28,8 @@ const ZanNoticeBar = { return; } + clearTimeout(this.data[componentId].setTimeoutId) + currentComponent.wrapWidth = rect.width; if (currentComponent.wrapWidth < currentComponent.width) { var mstime = currentComponent.width / 40 * 1000; @@ -60,9 +62,12 @@ const ZanNoticeBar = { }); }, 100); - setTimeout(() => { + const setTimeoutId = setTimeout(() => { this.scrollZanNoticeBar(componentId, mstime); }, mstime); + this.setData({ + [`${componentId}.setTimeoutId`]: setTimeoutId + }) } };