mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-03 14:20:50 +08:00
Merge branch 'main' into feat/music-reparse
This commit is contained in:
@@ -326,29 +326,22 @@ watch([songsLoadMoreRef, albumsLoadMoreRef], () => {
|
||||
setupObservers();
|
||||
});
|
||||
|
||||
// 监听路由参数变化,避免URL改变但未触发组件重新创建
|
||||
watch(
|
||||
() => route.params.id,
|
||||
(newId, oldId) => {
|
||||
if (newId && newId !== oldId) {
|
||||
previousId.value = newId as string;
|
||||
loadArtistInfo();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onActivated(() => {
|
||||
// 确保当前路由是艺术家详情页
|
||||
if (route.name === 'artistDetail') {
|
||||
const currentId = route.params.id as string;
|
||||
|
||||
// 首次加载或ID变化时加载数据
|
||||
if (!previousId.value || previousId.value !== currentId) {
|
||||
console.log('ID已变化,加载新数据');
|
||||
previousId.value = currentId;
|
||||
activeTab.value = 'songs';
|
||||
loadArtistInfo();
|
||||
}
|
||||
|
||||
// 重新设置观察器
|
||||
setupObservers();
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user