Skip to content
Snippets Groups Projects
Commit 3681ae00 authored by onny's avatar onny
Browse files

fix load more

parent dce2b083
No related branches found
No related tags found
No related merge requests found
Pipeline #382 failed
......@@ -23,7 +23,7 @@
<div v-resize:debounce="onResize">
<slot />
<EmptyContent
v-show="!finished"
v-show="page !== null"
icon="icon-loading"
class="tableLoading" />
</div>
......@@ -42,9 +42,9 @@ export default {
resize,
},
props: {
finished: {
type: Boolean,
default: false,
page: {
type: Number,
default: 0,
},
},
mounted() {
......@@ -56,7 +56,8 @@ export default {
methods: {
preFill() {
if (this.finished) {
console.log('prefill: ', this.page)
if (this.page === null) {
document.getElementById('app-content-vue').removeEventListener('scroll', this.handleScroll)
} else {
const yFill = document.getElementsByClassName('tableLoading')[0].getBoundingClientRect().bottom
......@@ -71,7 +72,8 @@ export default {
* On scroll event, load more shows if bottom reached
*/
handleScroll() {
if (this.finished) {
console.log('scroll: ', this.page)
if (this.page === null) {
document.getElementById('app-content-vue').removeEventListener('scroll', this.handleScroll)
} else {
const appContent = document.getElementById('app-content-vue')
......
......@@ -66,21 +66,23 @@ export default {
podcasts = await showApiClient.queryCategory('hot', 20, page)
this.title = t('podcast', 'Hot podcasts')
this.podcasts = this.podcasts.concat(podcasts.data)
this.page += 1
} else if (this.category === 'new') {
podcasts = await showApiClient.queryCategory('latest', 20, page)
this.title = t('podcast', 'New podcasts')
this.podcasts = this.podcasts.concat(podcasts.data)
this.page += 1
} else if (this.category === 'subscriptions') {
podcasts = await showApiClient.queryShows(page)
this.title = t('podcast', 'My subscriptions')
this.podcasts = this.podcasts.concat(podcasts.data)
} else {
podcasts = await showApiClient.queryCategory(this.categoryId, 20, page)
this.title = t('podcast', 'Podcasts in') + ' ' + podcasts.data.category.title
this.podcasts = this.podcasts.concat(podcasts.data.podcasts)
if (podcasts.meta.paging.next_page === null) {
this.page = null
} else {
this.page += 1
}
}
if (podcasts.meta.paging.next_page === null) {
this.page = null
} else {
this.page += 1
}
setBrowserTitle(this.title)
},
......
......@@ -25,8 +25,9 @@
<Actions>
<ActionButton
icon="icon-details"
:close-after-click="true">
{{ t('podcast', 'Show all') }}
:close-after-click="true"
@click="$router.push('/browse/subscriptions')">
{{ t('podcast', 'Show all subscriptions') }}
</ActionButton>
<ActionButton
icon="icon-download"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment