mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-14 06:30:49 +08:00
🐞 fix: 修复播放历史不展示上下一首的问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<n-drawer :show="show" height="70vh" placement="bottom" :drawer-style="{ backgroundColor: 'transparent' }">
|
||||
<n-drawer v-model:show="show" height="70vh" placement="bottom" :drawer-style="{ backgroundColor: 'transparent' }">
|
||||
<div class="music-page">
|
||||
<i class="iconfont icon-icon_error music-close" @click="close"></i>
|
||||
<div class="music-title">{{ name }}</div>
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useStore } from 'vuex'
|
||||
import { Playlist } from '@/type/listDetail';
|
||||
import { setAnimationClass, setAnimationDelay } from "@/utils";
|
||||
import SongItem from "@/components/common/SongItem.vue";
|
||||
import PlayBottom from './common/PlayBottom.vue';
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
import { useStore } from 'vuex'
|
||||
import type { SongResult } from '@/type/music'
|
||||
import { getImgUrl } from '@/utils'
|
||||
import { useMusicHistory } from '@/hooks/MusicHistoryHook'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
item: SongResult
|
||||
@@ -68,15 +67,12 @@ const isPlaying = computed(() => {
|
||||
|
||||
const emits = defineEmits(['play'])
|
||||
|
||||
const musicHistory = useMusicHistory()
|
||||
|
||||
// 播放音乐 设置音乐详情 打开音乐底栏
|
||||
const playMusicEvent = (item: any) => {
|
||||
store.commit('setPlay', item)
|
||||
store.commit('setIsPlay', true)
|
||||
store.state.playListIndex = 0
|
||||
emits('play', item)
|
||||
musicHistory.addMusic(item)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user