mirror of
https://github.com/koel/koel
synced 2024-12-25 20:13:06 +00:00
13 lines
335 B
TypeScript
13 lines
335 B
TypeScript
|
import { computed } from 'vue'
|
||
|
import { secondsToHis } from '@/utils'
|
||
|
|
||
|
export const useAlbumAttributes = (album: Album) => {
|
||
|
const length = computed(() => album.songs.reduce((acc: number, song: Song) => acc + song.length, 0))
|
||
|
const fmtLength = computed(() => secondsToHis(length.value))
|
||
|
|
||
|
return {
|
||
|
length,
|
||
|
fmtLength
|
||
|
}
|
||
|
}
|