fix(music): 切换标签页后重置页码并优化数据请求逻辑

- 切换标签页时重置当前页码为第 1 页
- 根据不同的标签页请求对应的数据
- 增加对其他标签页的数据请求处理
This commit is contained in:
ikmkj
2025-07-26 11:12:05 +08:00
parent 5d9eca4929
commit 4b4aaedeef

View File

@@ -189,11 +189,13 @@ const fetchLatestMusic = async () => {
// 切换标签页
const handleTabChange = (tab) => {
activeTab.value = tab
if (tab === 'hot' && hotMusicList.value.length === 0) {
fetchHotMusic()
} else if (tab === 'latest' && latestMusicList.value.length === 0) {
fetchLatestMusic()
currentPage.value = 1; // 重置页码
if (tab.paneName === 'hot') {
fetchHotMusic();
} else if (tab.paneName === 'latest') {
fetchLatestMusic();
} else {
fetchMusicList();
}
}