Skip to content

Commit 258828f

Browse files
committed
✨ feat: 双击播放由双击歌曲名改为双击整个组件都可以
1 parent 91b1ff7 commit 258828f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/renderer/components/common/SongItem.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@contextmenu.prevent="handleContextMenu"
66
@mouseenter="handleMouseEnter"
77
@mouseleave="handleMouseLeave"
8+
@dblclick.stop="playMusicEvent(item)"
89
>
910
<div v-if="compact && index !== undefined" class="song-item-index" :class="{ 'text-green-500': isPlaying }">
1011
{{ index + 1 }}
@@ -42,7 +43,7 @@
4243
</div>
4344
<template v-else-if="compact">
4445
<div class="song-item-content-compact-wrapper">
45-
<div class="w-60 flex-shrink-0 flex items-center" @dblclick="playMusicEvent(item)">
46+
<div class="w-60 flex-shrink-0 flex items-center">
4647
<n-ellipsis class="song-item-content-title text-ellipsis" line-clamp="1" :class="{ 'text-green-500': isPlaying }">
4748
{{ item.name }}
4849
</n-ellipsis>
@@ -68,7 +69,7 @@
6869
</div>
6970
</template>
7071
<template v-else>
71-
<div class="song-item-content-title" @dblclick="playMusicEvent(item)">
72+
<div class="song-item-content-title">
7273
<n-ellipsis class="text-ellipsis" line-clamp="1" :class="{ 'text-green-500': isPlaying }">{{ item.name }}</n-ellipsis>
7374
</div>
7475
<div class="song-item-content-name">
@@ -449,7 +450,6 @@ const playMusicEvent = async (item: SongResult) => {
449450
if (!result) {
450451
throw new Error('播放失败');
451452
}
452-
playerStore.isPlay = true;
453453
emits('play', item);
454454
} catch (error) {
455455
console.error('播放出错:', error);

0 commit comments

Comments
 (0)