mirror of
https://github.com/koel/koel
synced 2024-12-21 01:53:11 +00:00
14 lines
388 B
TypeScript
14 lines
388 B
TypeScript
import { computed } from 'vue'
|
|
import { secondsToHis } from '@/utils'
|
|
|
|
export const useAlbumAttributes = () => {
|
|
const props = defineProps<{ album: Album }>()
|
|
const length = computed(() => props.album.songs.reduce((acc: number, song: Song) => acc + song.length, 0))
|
|
const fmtLength = computed(() => secondsToHis(length.value))
|
|
|
|
return {
|
|
props,
|
|
length,
|
|
fmtLength
|
|
}
|
|
}
|