fix genre page only showing 10 albums

This commit is contained in:
Thomas Amland
2020-12-13 11:56:01 +01:00
parent e077fabdca
commit b65eb4580c
3 changed files with 47 additions and 10 deletions
+34
View File
@@ -0,0 +1,34 @@
<template>
<div>
<slot :items="items" />
<InfiniteLoader :loading="loading" :has-more="hasMore" @load-more="loadMore" />
</div>
</template>
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
props: {
load: { type: Function, required: true },
},
data() {
return {
items: [] as any[],
loading: false,
offset: 0 as number,
hasMore: true,
}
},
methods: {
loadMore() {
this.loading = true
this.load(this.offset).then((items: any[]) => {
this.items.push(...items)
this.offset += items.length
this.hasMore = items.length > 0
this.loading = false
})
}
}
})
</script>