From f8efbe8ec6a720377961407fc8c16e4cd93f8095 Mon Sep 17 00:00:00 2001 From: alger Date: Thu, 4 Jan 2024 09:55:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E6=AC=A1=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/SongItem.vue | 1 - src/store/index.ts | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/common/SongItem.vue b/src/components/common/SongItem.vue index 7bd180e..e87f06c 100644 --- a/src/components/common/SongItem.vue +++ b/src/components/common/SongItem.vue @@ -71,7 +71,6 @@ const emits = defineEmits(['play']) const playMusicEvent = (item: any) => { store.commit('setPlay', item) store.commit('setIsPlay', true) - store.state.playListIndex = 0 emits('play', item) } diff --git a/src/store/index.ts b/src/store/index.ts index a178a45..888f398 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -50,7 +50,9 @@ const mutations = { state.play = play }, setPlayList(state: State, playList: SongResult[]) { - state.playListIndex = 0 + state.playListIndex = playList.findIndex( + (item) => item.id === state.playMusic.id + ) state.playList = playList }, async nextPlay(state: State) {