feat: 收藏功能改为接口对接

This commit is contained in:
alger
2025-01-04 16:58:08 +08:00
parent 11ced6b418
commit 43c64b1b43
3 changed files with 47 additions and 10 deletions
+3 -3
View File
@@ -54,7 +54,7 @@ const scrollbarRef = ref();
// 无限滚动相关
const pageSize = 16;
const currentPage = ref(1);
const props = defineProps({
isComponent: {
type: Boolean,
@@ -64,10 +64,9 @@ const props = defineProps({
// 获取当前页的收藏歌曲ID
const getCurrentPageIds = () => {
const reversedList = [...favoriteList.value];
const startIndex = (currentPage.value - 1) * pageSize;
const endIndex = startIndex + pageSize;
return reversedList.slice(startIndex, endIndex);
return favoriteList.value.slice(startIndex, endIndex);
};
// 获取收藏歌曲详情
@@ -120,6 +119,7 @@ const handleScroll = (e: any) => {
};
onMounted(() => {
store.dispatch('initializeFavoriteList');
getFavoriteSongs();
});