Skip to content

Commit d02805b

Browse files
🎈 perf: 优化歌单对于单曲循环的自动切换
1 parent e42787b commit d02805b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/composables/List/useListActions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
import type { SongType } from "@/types/main";
22
import { usePlayerController } from "@/core/player/PlayerController";
3+
import { useStatusStore } from "@/stores";
34

45
/**
56
* 列表操作逻辑
67
*/
78
export const useListActions = () => {
89
const player = usePlayerController();
10+
const statusStore = useStatusStore();
911

1012
/**
1113
* 播放全部歌曲
1214
*/
1315
const playAllSongs = (songs: SongType[], playListId?: number) => {
1416
if (!songs?.length) return;
17+
// 如果是单曲循环模式,自动切换为顺序播放
18+
if (statusStore.playSongMode === "repeat-once") {
19+
player.togglePlayMode("repeat");
20+
}
1521
player.updatePlayList(songs, undefined, playListId);
1622
};
1723

0 commit comments

Comments
 (0)