🐞 fix: 修复播放次序问题

This commit is contained in:
alger
2024-01-04 09:55:41 +08:00
parent 67d42a2291
commit f8efbe8ec6
2 changed files with 3 additions and 2 deletions
-1
View File
@@ -71,7 +71,6 @@ const emits = defineEmits(['play'])
const playMusicEvent = (item: any) => { const playMusicEvent = (item: any) => {
store.commit('setPlay', item) store.commit('setPlay', item)
store.commit('setIsPlay', true) store.commit('setIsPlay', true)
store.state.playListIndex = 0
emits('play', item) emits('play', item)
} }
</script> </script>
+3 -1
View File
@@ -50,7 +50,9 @@ const mutations = {
state.play = play state.play = play
}, },
setPlayList(state: State, playList: SongResult[]) { setPlayList(state: State, playList: SongResult[]) {
state.playListIndex = 0 state.playListIndex = playList.findIndex(
(item) => item.id === state.playMusic.id
)
state.playList = playList state.playList = playList
}, },
async nextPlay(state: State) { async nextPlay(state: State) {