🐞 fix: 修复播放历史不展示上下一首的问题

This commit is contained in:
alger
2024-01-02 11:08:02 +08:00
parent adb539fbde
commit ad5d5458f1
3 changed files with 6 additions and 6 deletions
+5
View File
@@ -3,6 +3,7 @@ import { SongResult } from '@/type/music'
import { getMusicUrl, getParsingMusicUrl } from '@/api/music'
import homeRouter from '@/router/home'
import { getMusicProxyUrl } from '@/utils'
import { useMusicHistory } from '@/hooks/MusicHistoryHook'
interface State {
menus: any[]
@@ -30,6 +31,8 @@ const state: State = {
const windowData = window as any
const musicHistory = useMusicHistory()
const mutations = {
setMenus(state: State, menus: any[]) {
state.menus = menus
@@ -38,6 +41,7 @@ const mutations = {
state.playMusic = playMusic
state.playMusicUrl = await getSongUrl(playMusic.id)
state.play = true
musicHistory.addMusic(playMusic)
},
setIsPlay(state: State, isPlay: boolean) {
state.isPlay = isPlay
@@ -94,6 +98,7 @@ const updatePlayMusic = async (state: State) => {
state.playMusic = state.playList[state.playListIndex]
state.playMusicUrl = await getSongUrl(state.playMusic.id)
state.play = true
musicHistory.addMusic(state.playMusic)
}
const store = createStore({