mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-07-28 13:41:42 +00:00
show track number as index in album page
This commit is contained in:
parent
4b522fd317
commit
866f3278a5
@ -10,10 +10,10 @@
|
||||
</div>
|
||||
<div class="songlist">
|
||||
<SongItem
|
||||
v-for="(track, index) in tracks"
|
||||
v-for="track in getTracks()"
|
||||
:key="track.trackid"
|
||||
:song="track"
|
||||
:index="index + 1"
|
||||
:index="track.index"
|
||||
@updateQueue="updateQueue"
|
||||
:isPlaying="queue.playing"
|
||||
:isCurrent="queue.current.trackid == track.trackid"
|
||||
@ -43,6 +43,7 @@ const props = defineProps<{
|
||||
path?: string;
|
||||
pname?: string;
|
||||
playlistid?: string;
|
||||
on_album_page?: boolean;
|
||||
}>();
|
||||
|
||||
let route = useRoute().name;
|
||||
@ -68,6 +69,24 @@ function updateQueue(track: Track) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getTracks() {
|
||||
if (props.on_album_page) {
|
||||
let tracks = props.tracks.map((track, index) => {
|
||||
track.index = track.tracknumber;
|
||||
return track;
|
||||
});
|
||||
|
||||
return tracks;
|
||||
}
|
||||
|
||||
let tracks = props.tracks.map((track, index) => {
|
||||
track.index = index + 1;
|
||||
return track;
|
||||
});
|
||||
|
||||
return tracks;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -15,6 +15,7 @@ export interface Track {
|
||||
image: string;
|
||||
tracknumber?: number;
|
||||
disknumber?: number;
|
||||
index?: number
|
||||
}
|
||||
|
||||
export interface Folder {
|
||||
|
@ -5,7 +5,7 @@
|
||||
</div>
|
||||
<div class="separator" id="av-sep"></div>
|
||||
<div class="songs rounded">
|
||||
<SongList :tracks="album.tracks" />
|
||||
<SongList :tracks="album.tracks" :on_album_page="true"/>
|
||||
</div>
|
||||
<div class="separator" id="av-sep"></div>
|
||||
<FeaturedArtists :artists="album.artists" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user