We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce67e74 commit dc7f011Copy full SHA for dc7f011
1 file changed
src/utils/player.ts
@@ -796,11 +796,20 @@ class Player {
796
return;
797
}
798
// 尝试添加
799
+ const currentSongId = musicStore.playSong.id;
800
const songIndex = await dataStore.setNextPlaySong(song, statusStore.playIndex);
801
// 播放歌曲
802
if (songIndex < 0) return;
- if (play) this.togglePlayIndex(songIndex, true);
803
- else window.$message.success("已添加至下一首播放");
+ if (play) {
804
+ this.togglePlayIndex(songIndex, true);
805
+ } else {
806
+ // 修正当前播放索引
807
+ const newCurrentIndex = dataStore.playList.findIndex((s) => s.id === currentSongId);
808
+ if (newCurrentIndex !== -1 && newCurrentIndex !== statusStore.playIndex) {
809
+ statusStore.playIndex = newCurrentIndex;
810
+ }
811
+ window.$message.success("已添加至下一首播放");
812
813
814
/**
815
* 切换播放索引
0 commit comments