From 1dd178c50732f32f59de04d0b27d217e4d29f151 Mon Sep 17 00:00:00 2001 From: Yi Feng <66539215+bigyifeng@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:20:33 +0800 Subject: [PATCH 1/3] chore: Correct the wrong word --- .../vue-virtual-scroller/src/components/RecycleScroller.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue index 40680cb6..752e017f 100644 --- a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue +++ b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue @@ -387,8 +387,8 @@ export default { // It seems sometimes chrome doesn't fire scroll event :/ // When non continous scrolling is ending, we force a refresh if (!continuous) { - clearTimeout(this.$_refreshTimout) - this.$_refreshTimout = setTimeout(this.handleScroll, this.updateInterval + 100) + clearTimeout(this.$_refreshTimeout) + this.$_refreshTimeout = setTimeout(this.handleScroll, this.updateInterval + 100) } }) From 2eae1f3d9124e163b3da7766c9d21920e6fc9359 Mon Sep 17 00:00:00 2001 From: Yi Feng <66539215+bigyifeng@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:38:37 +0800 Subject: [PATCH 2/3] feat: Added missing emit events --- .../vue-virtual-scroller/src/components/RecycleScroller.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue index 752e017f..26246554 100644 --- a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue +++ b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue @@ -378,6 +378,7 @@ export default { handleScroll (event) { if (!this.$_scrollDirty) { this.$_scrollDirty = true + this.$emit('scroll-start', this.getScroll()); if (this.$_updateTimeout) return const requestUpdate = () => requestAnimationFrame(() => { @@ -389,6 +390,7 @@ export default { if (!continuous) { clearTimeout(this.$_refreshTimeout) this.$_refreshTimeout = setTimeout(this.handleScroll, this.updateInterval + 100) + this.$emit('scroll-end', this.getScroll()); } }) From d3c7202d179f918f1436eb074b109a8ef8dccd8f Mon Sep 17 00:00:00 2001 From: Yi Feng <66539215+bigyifeng@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:41:35 +0800 Subject: [PATCH 3/3] chore: Get rid of redundant code --- .../vue-virtual-scroller/src/components/RecycleScroller.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue index 26246554..bc0fc439 100644 --- a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue +++ b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue @@ -378,7 +378,8 @@ export default { handleScroll (event) { if (!this.$_scrollDirty) { this.$_scrollDirty = true - this.$emit('scroll-start', this.getScroll()); + const scroll = this.getScroll() + this.$emit('scroll-start',scroll); if (this.$_updateTimeout) return const requestUpdate = () => requestAnimationFrame(() => { @@ -390,7 +391,7 @@ export default { if (!continuous) { clearTimeout(this.$_refreshTimeout) this.$_refreshTimeout = setTimeout(this.handleScroll, this.updateInterval + 100) - this.$emit('scroll-end', this.getScroll()); + this.$emit('scroll-end', scroll); } })