gaoluyang
2026-06-29 27cd042df9aca0383a49f3514bc21958dd890912
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<script lang="ts" setup>
import type { MusicSong } from '../types';
 
import { inject, ref } from 'vue';
 
import { IconifyIcon } from '../../../../../../packages/icons/src';
 
import { Image } from 'ant-design-vue';
 
import { currentSongKey } from '../types';
 
defineOptions({ name: 'AiMusicSongCardIndex' });
 
withDefaults(defineProps<{ songInfo?: MusicSong }>(), {
  songInfo: () => ({}),
});
 
const emits = defineEmits(['play']);
 
const currentSong = inject(currentSongKey, ref<MusicSong>({}));
 
function playSong() {
  emits('play');
}
</script>
 
<template>
  <div class="mb-3 flex rounded p-3">
    <div class="relative" @click="playSong">
      <Image :src="songInfo.imageUrl" class="w-20 flex-none" />
      <div
        class="absolute left-0 top-0 flex h-full w-full cursor-pointer items-center justify-center bg-black bg-opacity-40"
      >
        <IconifyIcon
          :icon="
            currentSong.id === songInfo.id
              ? 'solar:pause-circle-bold'
              : 'mdi:arrow-right-drop-circle'
          "
          :size="30"
        />
      </div>
    </div>
    <div class="ml-2">
      <div>{{ songInfo.title }}</div>
      <div class="mt-2 line-clamp-2 text-xs">
        {{ songInfo.desc }}
      </div>
    </div>
  </div>
</template>