File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 11
11
<div class =" infinite-status-prompt" v-show =" isShowNoMore" >
12
12
<slot name =" no-more" >{{ slots.noMore }}</slot >
13
13
</div >
14
+ <div class =" infinite-status-prompt" v-show =" isShowError" >
15
+ <slot name =" error" :trigger =" attemptLoad" >
16
+ {{ slots.error }}
17
+ <br >
18
+ <button
19
+ class =" btn-try-infinite"
20
+ @click =" attemptLoad"
21
+ v-text =" slots.errorBtnText" >
22
+ </button >
23
+ </slot >
24
+ </div >
14
25
</div >
15
26
</template >
16
27
<script >
@@ -37,6 +48,9 @@ export default {
37
48
isShowSpinner () {
38
49
return this .status === STATUS .LOADING ;
39
50
},
51
+ isShowError () {
52
+ return this .status === STATUS .ERROR ;
53
+ },
40
54
isShowNoResults: {
41
55
cache: false , // disable cache to fix the problem of get slot text delay
42
56
get () {
@@ -159,6 +173,10 @@ export default {
159
173
reset : () => {
160
174
this .$emit (' $InfiniteLoading:reset' , { target: this });
161
175
},
176
+ error : () => {
177
+ this .status = STATUS .ERROR ;
178
+ throttleer .reset ();
179
+ },
162
180
};
163
181
},
164
182
/**
@@ -284,5 +302,22 @@ export default {
284
302
font-size : 14px ;
285
303
text-align : center ;
286
304
padding : 10px 0 ;
305
+
306
+ .btn-try-infinite {
307
+ margin-top : 5px ;
308
+ padding : 5px 10px ;
309
+ color : #999 ;
310
+ font-size : 14px ;
311
+ line-height : 1 ;
312
+ background : transparent ;
313
+ border : 1px solid #ccc ;
314
+ border-radius : 3px ;
315
+ outline : none ;
316
+ cursor : pointer ;
317
+
318
+ & :not (:active ):hover {
319
+ opacity : 0.8 ;
320
+ }
321
+ }
287
322
}
288
323
</style >
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ const system = {
34
34
const slots = {
35
35
noResults : 'No results :(' ,
36
36
noMore : 'No more data :)' ,
37
+ error : 'Opps, something went wrong :(' ,
38
+ errorBtnText : 'Retry' ,
37
39
} ;
38
40
39
41
/**
@@ -121,6 +123,7 @@ export const STATUS = {
121
123
READY : 0 ,
122
124
LOADING : 1 ,
123
125
COMPLETE : 2 ,
126
+ ERROR : 3 ,
124
127
} ;
125
128
126
129
export default {
You can’t perform that action at this time.
0 commit comments