feat: pagination loader

This commit is contained in:
Alex 2022-04-01 16:03:25 +13:00
parent d8c16f5456
commit 142afabda2
2 changed files with 12 additions and 3 deletions

View File

@ -1,12 +1,14 @@
// this is an loading animation for videos // this is an loading animation for videos
<template> <template>
<div> <div>
<v-sheet color="background" v-for="i in 10" :key="i"> <v-sheet color="background" v-for="i in count" :key="i">
<v-skeleton-loader type="image, list-item-avatar-two-line" /> <v-skeleton-loader type="image, list-item-avatar-two-line" />
</v-sheet> </v-sheet>
</div> </div>
</template> </template>
<script> <script>
export default {}; export default {
props: ["count"],
};
</script> </script>

View File

@ -7,10 +7,11 @@
<div> <div>
<!-- Video Loading Animation --> <!-- Video Loading Animation -->
<vid-load-renderer v-if="recommends.length == 0" /> <vid-load-renderer v-if="recommends.length == 0" :count="10" />
<div v-for="(section, index) in recommends" :key="index"> <div v-for="(section, index) in recommends" :key="index">
<horizontal-list-renderer :render="section.contents[0]" /> <horizontal-list-renderer :render="section.contents[0]" />
</div> </div>
<vid-load-renderer v-if="!loading" :count="1" />
<observer @intersect="paginate" /> <observer @intersect="paginate" />
</div> </div>
</template> </template>
@ -33,9 +34,14 @@ export default {
}, },
}, },
data: {
loading: false,
},
methods: { methods: {
paginate() { paginate() {
if (this.recommends) { if (this.recommends) {
this.loading = true;
this.$youtube this.$youtube
.recommendContinuation( .recommendContinuation(
this.recommends[this.recommends.length - 1].continuations.find( this.recommends[this.recommends.length - 1].continuations.find(
@ -44,6 +50,7 @@ export default {
"browse" "browse"
) )
.then((result) => { .then((result) => {
this.loading = false;
this.recommends.push(result); this.recommends.push(result);
}); });
} }