fix(player): 双击歌曲时同步设置播放列表上下文

BaseSongItem 双击和右键菜单"播放"只调了 setPlay,未 emit 'play',
导致父组件 setPlayList 不会执行,上下一首切换失效。抽出统一入口
先 emit 再触发播放,与点击播放按钮行为对齐。
This commit is contained in:
chengww
2026-05-17 20:46:47 +08:00
parent c15a10c098
commit fa818a020f
@@ -4,7 +4,7 @@
@contextmenu.prevent="handleContextMenu" @contextmenu.prevent="handleContextMenu"
@mouseenter="handleMouseEnter" @mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave" @mouseleave="handleMouseLeave"
@dblclick.stop="playMusicEvent(item)" @dblclick.stop="handlePlay(item)"
> >
<slot name="index"></slot> <slot name="index"></slot>
<slot name="select" v-if="selectable"></slot> <slot name="select" v-if="selectable"></slot>
@@ -22,7 +22,7 @@
:is-dislike="isDislike" :is-dislike="isDislike"
:can-remove="canRemove" :can-remove="canRemove"
@update:show="showDropdown = $event" @update:show="showDropdown = $event"
@play="playMusicEvent(item)" @play="handlePlay(item)"
@play-next="handlePlayNext" @play-next="handlePlayNext"
@download="downloadMusic(item)" @download="downloadMusic(item)"
@download-lyric="downloadLyric(item)" @download-lyric="downloadLyric(item)"
@@ -83,6 +83,12 @@ const imageLoad = async (event: Event) => {
await handleImageLoad(target); await handleImageLoad(target);
}; };
// 双击和右键菜单"播放"统一入口:先通知父组件设置播放列表上下文,再触发播放
const handlePlay = (song: SongResult) => {
emits('play', song);
playMusicEvent(song);
};
// 切换选择状态 // 切换选择状态
const toggleSelect = () => { const toggleSelect = () => {
emits('select', props.item.id, !props.selected); emits('select', props.item.id, !props.selected);