File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" infinite-loading-container" >
3
3
<i class =" icon-loading" v-show =" isLoading" ></i >
4
+ <div class =" infinite-status-tips" v-show =" !isLoading && isNoResults" >
5
+ <slot name =" no-results" >No results :(</slot >
6
+ </div >
7
+ <div class =" infinite-status-tips" v-show =" !isLoading && isNoMore" >
8
+ <slot name =" no-more" >No more data :)</slot >
9
+ </div >
4
10
</div >
5
11
</template >
6
12
<script >
41
47
isLoading: false ,
42
48
scrollParent: null ,
43
49
scrollHandler: null ,
50
+ isNoResults: false ,
51
+ isNoMore: false ,
44
52
};
45
53
},
46
54
props: {
72
80
' $InfiniteLoading:loaded' () {
73
81
this .isLoading = false ;
74
82
},
83
+ ' $InfiniteLoading:noResults' () {
84
+ this .isLoading = false ;
85
+ this .isNoMore = false ;
86
+ this .isNoResults = true ;
87
+ this .scrollParent .removeEventListener (' scroll' , this .scrollHandler );
88
+ },
89
+ ' $InfiniteLoading:noMore' () {
90
+ this .isLoading = false ;
91
+ this .isNoResults = false ;
92
+ this .isNoMore = true ;
93
+ this .scrollParent .removeEventListener (' scroll' , this .scrollHandler );
94
+ },
75
95
},
76
96
destroyed () {
77
- this .scrollParent .removeEventListener (' scroll' , this .scrollHandler );
97
+ if (! this .isNoResults && ! this .isNoMore ) {
98
+ this .scrollParent .removeEventListener (' scroll' , this .scrollHandler );
99
+ }
78
100
},
79
101
};
80
102
</script >
113
135
}
114
136
}
115
137
138
+ .infinite-status-tips {
139
+ color : #666 ;
140
+ font-size : 14px ;
141
+ text-align : center ;
142
+ padding : 10px 0 ;
143
+ }
144
+
116
145
@keyframes loading{
117
146
0% {
118
147
transform : rotate (-38deg );
You can’t perform that action at this time.
0 commit comments