File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 8383 this .scrollParent = getScrollParent (this .$el );
8484
8585 this .scrollHandler = function scrollHandlerOriginal () {
86- const currentDistance = getCurrentDistance (this .scrollParent );
87- if (! this .isLoading && currentDistance <= this .distance ) {
88- this .isLoading = true ;
89- if (this .onInfinite ) {
90- this .onInfinite .call ();
91- }
86+ if (! this .isLoading ) {
87+ this .attemptLoad ();
9288 }
9389 }.bind (this );
9490
9591 setTimeout (this .scrollHandler , 1 );
9692 this .scrollParent .addEventListener (' scroll' , this .scrollHandler );
9793
9894 this .$on (' $InfiniteLoading:loaded' , () => {
99- this .isLoading = false ;
10095 this .isFirstLoad = false ;
96+ if (this .isLoading ) {
97+ this .$nextTick (this .attemptLoad );
98+ }
10199 });
102100 this .$on (' $InfiniteLoading:complete' , () => {
103101 this .isLoading = false ;
112110 setTimeout (this .scrollHandler , 1 );
113111 });
114112 },
113+ methods: {
114+ attemptLoad () {
115+ const currentDistance = getCurrentDistance (this .scrollParent , this .direction );
116+ if (! this .isComplete && currentDistance <= this .distance ) {
117+ this .isLoading = true ;
118+ this .onInfinite .call ();
119+ } else {
120+ this .isLoading = false ;
121+ }
122+ },
123+ },
115124 destroyed () {
116125 if (! this .isComplete ) {
117126 this .scrollParent .removeEventListener (' scroll' , this .scrollHandler );
You can’t perform that action at this time.
0 commit comments