播放 空格控制播放 播放进度条

This commit is contained in:
algerkong
2021-07-21 22:30:55 +08:00
parent 36225628b6
commit 8fe10268ec
3 changed files with 39 additions and 5 deletions
+7 -2
View File
@@ -20,6 +20,7 @@ let state = {
text: "hello",
},
],
play: false,
isPlay: false,
playMusic: {} as SongResult,
playMusicUrl: "",
@@ -29,13 +30,17 @@ let mutations = {
setMenus(state: any, menus: any[]) {
state.menus = menus;
},
setPlay(state: any, playMusic: SongResult) {
async setPlay(state: any, playMusic: SongResult) {
state.playMusic = playMusic;
state.playMusicUrl = getSongUrl(playMusic.id);
state.playMusicUrl = await getSongUrl(playMusic.id);
state.play = true;
},
setIsPlay(state: any, isPlay: boolean) {
state.isPlay = isPlay;
},
setPlayMusic(state: any, play: boolean) {
state.play = play;
},
};
const getSongUrl = async (id: number) => {