Merge pull request #708 from jiang-LJ/main

feat(player): 在播放栏添加下载当前歌曲按钮
This commit is contained in:
alger
2026-07-05 13:55:34 +08:00
6 changed files with 23 additions and 0 deletions
@@ -151,6 +151,16 @@
</template>
{{ t('player.playBar.reparse') }}
</n-tooltip>
<n-tooltip v-if="playMusic?.id" trigger="hover" :z-index="9999999">
<template #trigger>
<i
class="iconfont ri-download-line"
:class="{ 'disabled-icon': isDownloading }"
@click="playMusic?.id && handleDownload()"
/>
</template>
{{ isDownloading ? t('songItem.message.downloading') : t('player.playBar.download') }}
</n-tooltip>
<!-- 高级控制菜单按钮整合了 EQ定时关闭播放速度 -->
<advanced-controls-popover />
@@ -189,6 +199,7 @@ import {
textColors
} from '@/hooks/MusicHook';
import { useArtist } from '@/hooks/useArtist';
import { useDownload } from '@/hooks/useDownload';
import { useFavorite } from '@/hooks/useFavorite';
import { usePlaybackControl } from '@/hooks/usePlaybackControl';
import { usePlayMode } from '@/hooks/usePlayMode';
@@ -217,6 +228,13 @@ const {
// 收藏
const { isFavorite, toggleFavorite } = useFavorite();
// 下载
const { downloadMusic, isDownloading } = useDownload();
const handleDownload = () => {
if (!playMusic.value || isDownloading.value) return;
downloadMusic(playMusic.value);
};
// 播放模式
const { playMode, playModeIcon, playModeText, togglePlayMode } = usePlayMode();