2025-10-22 21:51:16 +08:00
|
|
|
<template>
|
2026-03-15 14:14:52 +08:00
|
|
|
<history-item
|
|
|
|
|
:image-url="getImgUrl(item.coverImgUrl || item.picUrl || '', '100y100')"
|
|
|
|
|
:name="item.name"
|
|
|
|
|
:description="getDescription()"
|
|
|
|
|
:count="item.count"
|
|
|
|
|
:show-count="showCount"
|
|
|
|
|
:show-delete="showDelete"
|
|
|
|
|
@click="emit('click', item)"
|
|
|
|
|
@delete="emit('delete', item)"
|
|
|
|
|
/>
|
2025-10-22 21:51:16 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
|
|
2026-03-15 14:14:52 +08:00
|
|
|
import HistoryItem from '@/components/common/HistoryItem.vue';
|
2026-02-06 20:35:04 +08:00
|
|
|
import type { PlaylistHistoryItem } from '@/store/modules/playHistory';
|
2025-10-22 21:51:16 +08:00
|
|
|
import { getImgUrl } from '@/utils';
|
|
|
|
|
|
2026-03-15 14:14:52 +08:00
|
|
|
const props = withDefaults(
|
|
|
|
|
defineProps<{
|
|
|
|
|
item: PlaylistHistoryItem;
|
|
|
|
|
showCount?: boolean;
|
|
|
|
|
showDelete?: boolean;
|
|
|
|
|
}>(),
|
|
|
|
|
{
|
|
|
|
|
showCount: false,
|
|
|
|
|
showDelete: false
|
|
|
|
|
}
|
|
|
|
|
);
|
2025-10-22 21:51:16 +08:00
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
click: [item: PlaylistHistoryItem];
|
|
|
|
|
delete: [item: PlaylistHistoryItem];
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
|
|
|
|
|
|
|
const getDescription = () => {
|
|
|
|
|
const parts: string[] = [];
|
2026-03-15 14:14:52 +08:00
|
|
|
if (props.item.trackCount !== undefined)
|
2025-10-22 21:51:16 +08:00
|
|
|
parts.push(t('user.playlist.trackCount', { count: props.item.trackCount }));
|
2026-03-15 14:14:52 +08:00
|
|
|
if (props.item.creator?.nickname) parts.push(props.item.creator.nickname);
|
2025-10-22 21:51:16 +08:00
|
|
|
return parts.join(' · ') || t('history.noDescription');
|
|
|
|
|
};
|
|
|
|
|
</script>
|