重开一个组件再写当前播放完成
This commit is contained in:
@@ -75,7 +75,7 @@ const playNext = async (step) => {
|
||||
case 3: //随机
|
||||
if (playingList.length <= 1) return; //只有一首歌
|
||||
const i = Math.floor(Math.random() * (playingList.length - 1));
|
||||
if (i >= idx) idx = i+1;
|
||||
if (i >= idx) idx = i + 1;
|
||||
else idx = i;
|
||||
break;
|
||||
}
|
||||
@@ -90,6 +90,18 @@ const forward = async () => {
|
||||
playNext(1);
|
||||
};
|
||||
|
||||
const stop = async () => {
|
||||
pause();
|
||||
if (store.state.settings.playingList.length < 1) {
|
||||
audioEl.value.src = "";
|
||||
lastPause = 0;
|
||||
store.commit("saveSettings", {
|
||||
songId: null,
|
||||
});
|
||||
pubsub.publish('zp.hideSongInfo')
|
||||
}
|
||||
};
|
||||
|
||||
const play = async (id, im = true) => {
|
||||
console.log(id);
|
||||
await getSongUrl(id)
|
||||
@@ -177,6 +189,12 @@ const psToken = pubsub.subscribe("zp", (msg, data) => {
|
||||
case "zp.play":
|
||||
play(data.id, data.im);
|
||||
break;
|
||||
case "zp.next":
|
||||
forward();
|
||||
break;
|
||||
case "zp.stop":
|
||||
stop();
|
||||
break;
|
||||
case "zp.setProgressScale":
|
||||
setProgressScale(data.scale);
|
||||
break;
|
||||
@@ -249,13 +267,13 @@ onUnmounted(() => {
|
||||
</n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
<n-button circle>
|
||||
<!-- <n-button circle>
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
<TrashOutline />
|
||||
</n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
</n-button> -->
|
||||
</n-space>
|
||||
|
||||
<!-- </div> -->
|
||||
|
||||
Reference in New Issue
Block a user