remove limit in genre track list
This commit is contained in:
parent
b65eb4580c
commit
181cd70bc6
@ -14,12 +14,12 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<template v-if="section === 'tracks'">
|
<template v-if="section === 'tracks'">
|
||||||
<ContentLoader v-slot :loading="tracks == null">
|
<InfiniteList v-slot="{ items }" key="tracks" :load="loadTracks">
|
||||||
<TrackList :tracks="tracks" />
|
<TrackList :tracks="items" />
|
||||||
</ContentLoader>
|
</InfiniteList>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<InfiniteList v-slot="{ items }" :load="loadAlbums">
|
<InfiniteList v-slot="{ items }" key="albums" :load="loadAlbums">
|
||||||
<AlbumList :items="items" />
|
<AlbumList :items="items" />
|
||||||
</InfiniteList>
|
</InfiniteList>
|
||||||
</template>
|
</template>
|
||||||
@ -41,20 +41,13 @@
|
|||||||
id: { type: String, required: true },
|
id: { type: String, required: true },
|
||||||
section: { type: String, default: '' },
|
section: { type: String, default: '' },
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
tracks: null as null | any[],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.$api.getTracksByGenre(this.id).then(result => {
|
|
||||||
this.tracks = result
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
loadAlbums(offset: number) {
|
loadAlbums(offset: number) {
|
||||||
return this.$api.getAlbumsByGenre(this.id, 50, offset)
|
return this.$api.getAlbumsByGenre(this.id, 50, offset)
|
||||||
}
|
},
|
||||||
|
loadTracks(offset: number) {
|
||||||
|
return this.$api.getTracksByGenre(this.id, 50, offset)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -126,11 +126,11 @@ export class API {
|
|||||||
return (response.albumList2?.album || []).map(this.normalizeAlbum, this)
|
return (response.albumList2?.album || []).map(this.normalizeAlbum, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTracksByGenre(id: string) {
|
async getTracksByGenre(id: string, size: number, offset = 0) {
|
||||||
const params = {
|
const params = {
|
||||||
genre: id,
|
genre: id,
|
||||||
count: 500,
|
count: size,
|
||||||
offset: 0,
|
offset,
|
||||||
}
|
}
|
||||||
const response = await this.get('rest/getSongsByGenre', params)
|
const response = await this.get('rest/getSongsByGenre', params)
|
||||||
return (response.songsByGenre?.song || []).map(this.normalizeTrack, this)
|
return (response.songsByGenre?.song || []).map(this.normalizeTrack, this)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user