File tree 1 file changed +5
-11
lines changed
1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 49
49
if (dir === ' top' ) {
50
50
distance = scrollTop;
51
51
} else {
52
- const styles = getComputedStyle (elm === window ? document .body : elm);
53
- const innerHeight = elm === window
54
- ? window .innerHeight
55
- : parseInt (styles .height , 10 );
56
- const scrollHeight = elm === window
57
- ? document .body .scrollHeight
58
- : elm .scrollHeight ;
59
- const paddingTop = parseInt (styles .paddingTop , 10 );
60
- const paddingBottom = parseInt (styles .paddingBottom , 10 );
52
+ const scrollElmHeight = elm === window ?
53
+ window .innerHeight :
54
+ elm .getBoundingClientRect ().height ;
61
55
62
- distance = scrollHeight - innerHeight - scrollTop - paddingTop - paddingBottom ;
56
+ distance = this . $el . offsetTop - scrollTop - scrollElmHeight - ( elm . offsetTop || 0 ) ;
63
57
}
64
58
65
59
return distance;
129
123
},
130
124
methods: {
131
125
attemptLoad () {
132
- const currentDistance = getCurrentDistance (this .scrollParent , this .direction );
126
+ const currentDistance = getCurrentDistance . bind ( this ) (this .scrollParent , this .direction );
133
127
if (! this .isComplete && currentDistance <= this .distance ) {
134
128
this .isLoading = true ;
135
129
this .onInfinite .call ();
You can’t perform that action at this time.
0 commit comments