File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 72
72
isLoading: false ,
73
73
isComplete: false ,
74
74
isFirstLoad: true , // save the current loading whether it is the first loading
75
+ debounceTimer: null ,
76
+ debounceDuration: 100 ,
75
77
};
76
78
},
77
79
computed: {
112
114
mounted () {
113
115
this .scrollParent = getScrollParent (this .$el );
114
116
115
- this .scrollHandler = function scrollHandlerOriginal () {
117
+ this .scrollHandler = function scrollHandlerOriginal (ev ) {
116
118
if (! this .isLoading ) {
117
- this .attemptLoad ();
119
+ clearTimeout (this .debounceTimer );
120
+
121
+ if (typeof ev === ' object' && ev .constructor === Event ) {
122
+ this .debounceTimer = setTimeout (this .attemptLoad , this .debounceDuration );
123
+ } else {
124
+ this .attemptLoad ();
125
+ }
118
126
}
119
127
}.bind (this );
120
128
You can’t perform that action at this time.
0 commit comments