From 51ad6e818e9c87c6bbfe5a84c4cdfd94a4fb81df Mon Sep 17 00:00:00 2001 From: yuchumian Date: Thu, 20 May 2021 10:13:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E7=94=A8=E8=BD=AE=E6=92=AD?= =?UTF-8?q?=E8=A1=A8updateRows=E6=96=B9=E6=B3=95=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=8D=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 列表拥有数据后,置空数据列表此时动画定时停止,当再次调用`updateRows`进行数据更新时`animationHandler`不为空,以至于不会触发`animation`方法导致数据不更新 --- src/components/scrollBoard/src/main.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/scrollBoard/src/main.vue b/src/components/scrollBoard/src/main.vue index 70511e3..44efee3 100644 --- a/src/components/scrollBoard/src/main.vue +++ b/src/components/scrollBoard/src/main.vue @@ -351,7 +351,11 @@ export default { const rowLength = rowsData.length - if (rowNum >= rowLength) return + if (rowNum >= rowLength) { + // clear setTimeout and animationHandler + this.stopAnimation() + return + } if (start) { await new Promise(resolve => setTimeout(resolve, waitTime)) @@ -387,6 +391,8 @@ export default { if (!animationHandler) return clearTimeout(animationHandler) + // clear animationHandler + this.animationHandler = null }, emitEvent (type, ri, ci, row, ceil) { const { ceils, rowIndex } = row