mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-07-08 02:17:30 +08:00
fix(mini): 迷你模式右键'添加到歌单'恢复主窗口后接力打开歌单抽屉
Mini 窗口宽 340px 容不下 420px 歌单抽屉,此前 provide 的是空实现点击 无反应。现记录待添加歌曲 → window.api.restore() 恢复主窗口 → AppLayout 挂载后自动打开歌单抽屉完成添加。 Closes #504
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
// 切换播放列表显示/隐藏
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user