From 4ac69c5b2433bbc0794065bc4995cdb29a983ca4 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Sun, 13 Oct 2019 21:22:18 +0800 Subject: [PATCH] fix(affix): top shift when scroll too fast --- packages/common/Affix/src/main.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/common/Affix/src/main.vue b/packages/common/Affix/src/main.vue index 5631d017d..9c550e812 100644 --- a/packages/common/Affix/src/main.vue +++ b/packages/common/Affix/src/main.vue @@ -74,7 +74,9 @@ export default { const { top } = this.$el.getBoundingClientRect() - this.memorizedTop = top + const containerScrollTop = this.container.scrollTop + const delta = containerScrollTop - this.top + this.memorizedTop = top + delta }, handleScroll (e) { const containerEl = this.container.nodeName === '#document' ? this.container.documentElement : this.container