mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-05-17 10:27:30 +08:00
✨ feat: 双击播放由双击歌曲名改为双击整个组件都可以
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
@contextmenu.prevent="handleContextMenu"
|
@contextmenu.prevent="handleContextMenu"
|
||||||
@mouseenter="handleMouseEnter"
|
@mouseenter="handleMouseEnter"
|
||||||
@mouseleave="handleMouseLeave"
|
@mouseleave="handleMouseLeave"
|
||||||
|
@dblclick.stop="playMusicEvent(item)"
|
||||||
>
|
>
|
||||||
<div v-if="compact && index !== undefined" class="song-item-index" :class="{ 'text-green-500': isPlaying }">
|
<div v-if="compact && index !== undefined" class="song-item-index" :class="{ 'text-green-500': isPlaying }">
|
||||||
{{ index + 1 }}
|
{{ index + 1 }}
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<template v-else-if="compact">
|
<template v-else-if="compact">
|
||||||
<div class="song-item-content-compact-wrapper">
|
<div class="song-item-content-compact-wrapper">
|
||||||
<div class="w-60 flex-shrink-0 flex items-center" @dblclick="playMusicEvent(item)">
|
<div class="w-60 flex-shrink-0 flex items-center">
|
||||||
<n-ellipsis class="song-item-content-title text-ellipsis" line-clamp="1" :class="{ 'text-green-500': isPlaying }">
|
<n-ellipsis class="song-item-content-title text-ellipsis" line-clamp="1" :class="{ 'text-green-500': isPlaying }">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</n-ellipsis>
|
</n-ellipsis>
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="song-item-content-title" @dblclick="playMusicEvent(item)">
|
<div class="song-item-content-title">
|
||||||
<n-ellipsis class="text-ellipsis" line-clamp="1" :class="{ 'text-green-500': isPlaying }">{{ item.name }}</n-ellipsis>
|
<n-ellipsis class="text-ellipsis" line-clamp="1" :class="{ 'text-green-500': isPlaying }">{{ item.name }}</n-ellipsis>
|
||||||
</div>
|
</div>
|
||||||
<div class="song-item-content-name">
|
<div class="song-item-content-name">
|
||||||
@@ -449,7 +450,6 @@ const playMusicEvent = async (item: SongResult) => {
|
|||||||
if (!result) {
|
if (!result) {
|
||||||
throw new Error('播放失败');
|
throw new Error('播放失败');
|
||||||
}
|
}
|
||||||
playerStore.isPlay = true;
|
|
||||||
emits('play', item);
|
emits('play', item);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('播放出错:', error);
|
console.error('播放出错:', error);
|
||||||
|
|||||||
Reference in New Issue
Block a user