From dafd41cc2a881f31afb420bf809ad9b8e3850ee9 Mon Sep 17 00:00:00 2001 From: alger Date: Sun, 5 Jul 2026 15:16:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(mini):=20=E8=BF=B7=E4=BD=A0=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=8F=B3=E9=94=AE'=E6=B7=BB=E5=8A=A0=E5=88=B0?= =?UTF-8?q?=E6=AD=8C=E5=8D=95'=E6=81=A2=E5=A4=8D=E4=B8=BB=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E5=90=8E=E6=8E=A5=E5=8A=9B=E6=89=93=E5=BC=80=E6=AD=8C?= =?UTF-8?q?=E5=8D=95=E6=8A=BD=E5=B1=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mini 窗口宽 340px 容不下 420px 歌单抽屉,此前 provide 的是空实现点击 无反应。现记录待添加歌曲 → window.api.restore() 恢复主窗口 → AppLayout 挂载后自动打开歌单抽屉完成添加。 Closes #504 --- src/renderer/components/player/MiniPlayBar.vue | 6 ++++-- src/renderer/layout/AppLayout.vue | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/player/MiniPlayBar.vue b/src/renderer/components/player/MiniPlayBar.vue index aa4eda7..94369da 100644 --- a/src/renderer/components/player/MiniPlayBar.vue +++ b/src/renderer/components/player/MiniPlayBar.vue @@ -182,9 +182,11 @@ const palyListRef = useTemplateRef('palyListRef') as any; const isPlaylistOpen = ref(false); // 提供 openPlaylistDrawer 给子组件 +// Mini 窗口(340px 宽)容不下 420px 的歌单抽屉:记录待添加歌曲并恢复主窗口, +// AppLayout 重新挂载后接力打开抽屉(#504) provide('openPlaylistDrawer', (songId: number) => { - console.log('打开歌单抽屉', songId); - // 由于在迷你模式不处理这个功能,所以只记录日志 + localStorage.setItem('pendingAddToPlaylistSongId', String(songId)); + window.api.restore(); }); // 切换播放列表显示/隐藏 diff --git a/src/renderer/layout/AppLayout.vue b/src/renderer/layout/AppLayout.vue index 0e3a1c9..ab8c21a 100644 --- a/src/renderer/layout/AppLayout.vue +++ b/src/renderer/layout/AppLayout.vue @@ -122,6 +122,15 @@ const isPhone = computed(() => settingsStore.isMobile); onMounted(() => { settingsStore.initializeSettings(); settingsStore.initializeTheme(); + + // Mini 模式下点了"添加到歌单"会记录歌曲并恢复主窗口,这里接力打开抽屉(#504) + const pendingSongId = localStorage.getItem('pendingAddToPlaylistSongId'); + if (pendingSongId) { + localStorage.removeItem('pendingAddToPlaylistSongId'); + nextTick(() => { + openPlaylistDrawer(Number(pendingSongId)); + }); + } }); const showPlaylistDrawer = ref(false);