mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-08-02 04:54:43 +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);
|
const isPlaylistOpen = ref(false);
|
||||||
|
|
||||||
// 提供 openPlaylistDrawer 给子组件
|
// 提供 openPlaylistDrawer 给子组件
|
||||||
|
// Mini 窗口(340px 宽)容不下 420px 的歌单抽屉:记录待添加歌曲并恢复主窗口,
|
||||||
|
// AppLayout 重新挂载后接力打开抽屉(#504)
|
||||||
provide('openPlaylistDrawer', (songId: number) => {
|
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(() => {
|
onMounted(() => {
|
||||||
settingsStore.initializeSettings();
|
settingsStore.initializeSettings();
|
||||||
settingsStore.initializeTheme();
|
settingsStore.initializeTheme();
|
||||||
|
|
||||||
|
// Mini 模式下点了"添加到歌单"会记录歌曲并恢复主窗口,这里接力打开抽屉(#504)
|
||||||
|
const pendingSongId = localStorage.getItem('pendingAddToPlaylistSongId');
|
||||||
|
if (pendingSongId) {
|
||||||
|
localStorage.removeItem('pendingAddToPlaylistSongId');
|
||||||
|
nextTick(() => {
|
||||||
|
openPlaylistDrawer(Number(pendingSongId));
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const showPlaylistDrawer = ref(false);
|
const showPlaylistDrawer = ref(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user