diff --git a/src/views/chat/components/Message/index.vue b/src/views/chat/components/Message/index.vue index 48948c3..431e295 100644 --- a/src/views/chat/components/Message/index.vue +++ b/src/views/chat/components/Message/index.vue @@ -129,7 +129,7 @@ async function radioPlay() { onAudioEnd(playIndex) }) audioElements.push(a) - if(playing==false) playAudio() + if(playIndex==0||playing==false) playAudio(playIndex) } // for (let i = 0; i < props.mp3.length; i++) { @@ -154,9 +154,9 @@ const onAudioEnd = (index: any) => { // 创建音频对象的数组 const audioElements = reactive([]) // 播放音频 -const playAudio = () => { +const playAudio = (playIndex:any) => { // for (let i = 0; i < audioElements.length; i++) - audioElements[0].play() + audioElements[playIndex].play() } // 暂停音频