Skip to content

Commit 0efa4bd

Browse files
author
Guillaume Chau
committed
fix: getScroll polish
1 parent d7bb1cb commit 0efa4bd

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/mixins/scroller.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export default {
8484
},
8585

8686
methods: {
87-
8887
getListenerTarget () {
8988
let target = ScrollParent(this.$el)
9089
if (target === window.document.documentElement) {
@@ -95,7 +94,7 @@ export default {
9594

9695
getScroll () {
9796
const el = this.$el
98-
let scroll
97+
let scrollState
9998

10099
if (this.pageMode) {
101100
const rect = el.getBoundingClientRect()
@@ -108,22 +107,18 @@ export default {
108107
if (top + height > rect.height) {
109108
height = rect.height - top
110109
}
111-
scroll = {
112-
top: top,
110+
scrollState = {
111+
top,
113112
bottom: top + height,
114113
}
115114
} else {
116-
scroll = {
115+
scrollState = {
117116
top: el.scrollTop,
118117
bottom: el.scrollTop + el.clientHeight,
119118
}
120119
}
121120

122-
if (scroll.bottom >= 0 && scroll.top <= scroll.bottom) {
123-
return scroll
124-
} else {
125-
return null
126-
}
121+
return scrollState
127122
},
128123

129124
applyPageMode () {

0 commit comments

Comments
 (0)