feat: 添加专辑列表播放

This commit is contained in:
alger
2024-01-01 00:06:52 +08:00
parent 2dbf5dbf03
commit ecd7a56df0
10 changed files with 90 additions and 47 deletions
+17
View File
@@ -8,6 +8,7 @@
class="recommend-album-list-item"
:class="setAnimationClass('animate__backInUp')"
:style="setAnimationDelay(index, 100)"
@click="handleClick(item)"
>
<n-image
class="recommend-album-list-item-img"
@@ -19,6 +20,7 @@
</div>
</template>
</div>
<MusicList v-model:show="showMusic" :name="albumName" :song-list="songList" />
</div>
</template>
@@ -27,6 +29,7 @@ import { getNewAlbum } from "@/api/home"
import { ref, onMounted } from "vue";
import type { IAlbumNew } from "@/type/album"
import { setAnimationClass, setAnimationDelay, getImgUrl } from "@/utils";
import { getAlbum } from "@/api/list";
const albumData = ref<IAlbumNew>()
@@ -35,6 +38,20 @@ const loadAlbumList = async () => {
albumData.value = data
}
const showMusic = ref(false)
const songList = ref([])
const albumName = ref('')
const handleClick = async (item:any) => {
albumName.value = item.name
showMusic.value = true
const res = await getAlbum(item.id)
songList.value = res.data.songs.map((song:any)=>{
song.al.picUrl = song.al.picUrl || item.picUrl
return song
})
}
onMounted(() => {
loadAlbumList()
})