mirror of
https://github.com/koel/koel
synced 2024-12-23 02:53:20 +00:00
52 lines
1.1 KiB
Vue
52 lines
1.1 KiB
Vue
<template>
|
|
<article>
|
|
<h3 class="text-2xl mb-3">Track Listing</h3>
|
|
|
|
<ul>
|
|
<li
|
|
v-for="(track, index) in tracks"
|
|
:key="index"
|
|
class="flex p-2 before:w-7 before:opacity-50"
|
|
data-testid="album-track-item"
|
|
>
|
|
<TrackListItem :album="album" :track="track" />
|
|
</li>
|
|
</ul>
|
|
</article>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { onMounted, provide, ref, toRefs } from 'vue'
|
|
import { songStore } from '@/stores'
|
|
import { PlayablesKey } from '@/symbols'
|
|
|
|
import TrackListItem from '@/components/album/AlbumTrackListItem.vue'
|
|
|
|
const props = defineProps<{ album: Album, tracks: AlbumTrack[] }>()
|
|
const { album, tracks } = toRefs(props)
|
|
|
|
const songs = ref<Song[]>([])
|
|
|
|
// @ts-ignore
|
|
provide(PlayablesKey, songs)
|
|
|
|
onMounted(async () => songs.value = await songStore.fetchForAlbum(album.value))
|
|
</script>
|
|
|
|
<style lang="postcss" scoped>
|
|
ul {
|
|
counter-reset: trackCounter;
|
|
}
|
|
|
|
li {
|
|
counter-increment: trackCounter;
|
|
|
|
&::before {
|
|
content: counter(trackCounter);
|
|
}
|
|
|
|
&:nth-child(even) {
|
|
background: rgba(255, 255, 255, 0.05);
|
|
}
|
|
}
|
|
</style>
|