fix: duplicate key warning in explore page

master
kunkka 4 years ago
parent 5ab541096e
commit 4b9b93d60e

@ -102,10 +102,23 @@ export default {
getPlaylist() { getPlaylist() {
this.loadingMore = true; this.loadingMore = true;
if (this.activeCategory === "推荐歌单") { if (this.activeCategory === "推荐歌单") {
recommendPlaylist({ limit: 100 }).then((data) => { return this.getRecommendPlayList()
}
if (this.activeCategory === "精品歌单") {
return this.getHighQualityPlaylist()
}
if (this.activeCategory === "排行榜") {
return this.getTopLists()
}
return this.getTopPlayList()
},
getRecommendPlayList() {
recommendPlaylist({ limit: 100 }).then(data => {
this.playlists = []
this.updatePlaylist(data.result); this.updatePlaylist(data.result);
}); });
} else if (this.activeCategory === "精品歌单") { },
getHighQualityPlaylist() {
let playlists = this.playlists; let playlists = this.playlists;
let before = let before =
playlists.length !== 0 playlists.length !== 0
@ -115,21 +128,23 @@ export default {
this.updatePlaylist(data.playlists); this.updatePlaylist(data.playlists);
this.hasMore = data.more; this.hasMore = data.more;
}); });
} else if (this.activeCategory === "排行榜") { },
getTopLists() {
toplists().then((data) => { toplists().then((data) => {
this.playlists = []
this.updatePlaylist(data.list); this.updatePlaylist(data.list);
}); });
} else { },
getTopPlayList() {
topPlaylist({ topPlaylist({
cat: this.activeCategory, cat: this.activeCategory,
offset: this.playlists.length, offset: this.playlists.length,
}).then((data) => { }).then(data => {
this.updatePlaylist(data.playlists); this.updatePlaylist(data.playlists);
this.hasMore = data.more; this.hasMore = data.more;
}); });
} }
}, },
},
activated() { activated() {
this.loadData(); this.loadData();
}, },

Loading…
Cancel
Save