Don't show load more if results.length is zero
This commit is contained in:
@@ -14,8 +14,11 @@
|
|||||||
<results-list v-bind="{ results, shortList }" />
|
<results-list v-bind="{ results, shortList }" />
|
||||||
<loader v-if="loading" />
|
<loader v-if="loading" />
|
||||||
|
|
||||||
<div v-if="!shortList && page != totalPages" class="load-button">
|
<div class="load-button" ref="loadMoreButton">
|
||||||
<seasoned-button ref="loadMoreButton" @click="loadMore" :fullWidth="true"
|
<seasoned-button
|
||||||
|
v-if="!shortList && page != totalPages && results.length"
|
||||||
|
@click="loadMore"
|
||||||
|
:fullWidth="true"
|
||||||
>load more</seasoned-button
|
>load more</seasoned-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -121,7 +124,6 @@ export default {
|
|||||||
if (!front) this.results = this.results.concat(...results.results);
|
if (!front) this.results = this.results.concat(...results.results);
|
||||||
else this.results = results.results.concat(...this.results);
|
else this.results = results.results.concat(...this.results);
|
||||||
this.page = results.page;
|
this.page = results.page;
|
||||||
console.log("pushing page:", this.page);
|
|
||||||
this.loadedPages.push(this.page);
|
this.loadedPages.push(this.page);
|
||||||
this.loadedPages = this.loadedPages.sort((a, b) => a - b);
|
this.loadedPages = this.loadedPages.sort((a, b) => a - b);
|
||||||
this.totalPages = results.total_pages;
|
this.totalPages = results.total_pages;
|
||||||
@@ -137,7 +139,7 @@ export default {
|
|||||||
threshold: 1.0
|
threshold: 1.0
|
||||||
});
|
});
|
||||||
|
|
||||||
this.observer.observe(this.$refs.loadMoreButton.$el);
|
this.observer.observe(this.$refs.loadMoreButton);
|
||||||
},
|
},
|
||||||
handleButtonIntersection(entries) {
|
handleButtonIntersection(entries) {
|
||||||
entries.map(entry =>
|
entries.map(entry =>
|
||||||
|
|||||||
Reference in New Issue
Block a user