File tree Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change 55 <i :class =" spinnerType" ></i >
66 </slot >
77 </div >
8- <div class =" infinite-status-prompt" v-show =" !isLoading && isComplete && isFirstLoad " >
8+ <div class =" infinite-status-prompt" v-show =" isNoResults " >
99 <slot name =" no-results" >No results :(</slot >
1010 </div >
11- <div class =" infinite-status-prompt" v-show =" !isLoading && isComplete && !isFirstLoad " >
11+ <div class =" infinite-status-prompt" v-show =" isNoMore " >
1212 <slot name =" no-more" >No more data :)</slot >
1313 </div >
1414 </div >
7878 spinnerType () {
7979 return spinnerMapping[this .spinner ] || spinnerMapping .default ;
8080 },
81+ isNoResults: {
82+ cache: false , // disable cache to fix the problem of get slot text delay
83+ get () {
84+ const noResultsSlot = this .$slots [' no-results' ];
85+ const isBlankNoResultsSlot = (noResultsSlot && noResultsSlot[0 ].elm && noResultsSlot[0 ].elm .textContent === ' ' );
86+
87+ return ! this .isLoading && this .isComplete && this .isFirstLoad && ! isBlankNoResultsSlot;
88+ },
89+ },
90+ isNoMore: {
91+ cache: false , // disable cache to fix the problem of get slot text delay
92+ get () {
93+ const noMoreSlot = this .$slots [' no-more' ];
94+ const isBlankNoMoreSlot = (noMoreSlot && noMoreSlot[0 ].elm && noMoreSlot[0 ].elm .textContent === ' ' );
95+
96+ return ! this .isLoading && this .isComplete && ! this .isFirstLoad && ! isBlankNoMoreSlot;
97+ },
98+ },
8199 },
82100 props: {
83101 distance: {
109127 this .$nextTick (this .attemptLoad );
110128 }
111129 });
130+
112131 this .$on (' $InfiniteLoading:complete' , () => {
113132 this .isLoading = false ;
114133 this .isComplete = true ;
134+
135+ // force re-complation computed properties to fix the problem of get slot text delay
136+ this .$nextTick (() => {
137+ this .$forceUpdate ();
138+ });
115139 this .scrollParent .removeEventListener (' scroll' , this .scrollHandler );
116140 });
141+
117142 this .$on (' $InfiniteLoading:reset' , () => {
118143 this .isLoading = false ;
119144 this .isComplete = false ;
You can’t perform that action at this time.
0 commit comments