fix(affix): top shift when scroll too fast

This commit is contained in:
07akioni 2019-10-13 21:22:18 +08:00
parent 79635958a5
commit 4ac69c5b24

View File

@ -74,7 +74,9 @@ export default {
const { const {
top top
} = this.$el.getBoundingClientRect() } = this.$el.getBoundingClientRect()
this.memorizedTop = top const containerScrollTop = this.container.scrollTop
const delta = containerScrollTop - this.top
this.memorizedTop = top + delta
}, },
handleScroll (e) { handleScroll (e) {
const containerEl = this.container.nodeName === '#document' ? this.container.documentElement : this.container const containerEl = this.container.nodeName === '#document' ? this.container.documentElement : this.container