File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
packages/infinite-scroll/src Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,9 @@ const handleScroll = function(cb) {
92
92
93
93
if ( disabled ) return ;
94
94
95
+ const containerInfo = container . getBoundingClientRect ( ) ;
96
+ if ( ! containerInfo . width && ! containerInfo . height ) return ;
97
+
95
98
let shouldTrigger = false ;
96
99
97
100
if ( container === el ) {
Original file line number Diff line number Diff line change @@ -28,5 +28,31 @@ describe('InfiniteScroll', () => {
28
28
await wait ( ) ;
29
29
expect ( vm . $el . innerText . indexOf ( '2' ) > - 1 ) . to . be . true ;
30
30
} ) ;
31
+
32
+ it ( 'invisible element not trigger' , async ( ) => {
33
+ vm = createVue ( {
34
+ template : `
35
+ <div v-show="false">
36
+ <ul ref="scrollTarget" v-infinite-scroll="load" style="height: 300px;overflow: auto;">
37
+ <li v-for="i in count" style="display: flex;height: 50px;">{{ i }}</li>
38
+ </ul>
39
+ </div>
40
+ ` ,
41
+ data ( ) {
42
+ return {
43
+ count : 0
44
+ } ;
45
+ } ,
46
+ methods : {
47
+ load ( ) {
48
+ this . count += 2 ;
49
+ }
50
+ }
51
+ } , true ) ;
52
+ vm . $refs . scrollTarget . scrollTop = 2000 ;
53
+ await wait ( ) ;
54
+ expect ( vm . $el . innerText . indexOf ( '2' ) > - 1 ) . to . be . false ;
55
+ } ) ;
56
+
31
57
} ) ;
32
58
You can’t perform that action at this time.
0 commit comments