fix(custom): 修复页面卸载时音频不停止的bug

This commit is contained in:
2024-01-21 19:41:00 +08:00
parent 1be8bca950
commit e14cf86631
2 changed files with 17 additions and 1 deletions

View File

@@ -307,6 +307,7 @@ const startRun = (name: string) => {
setTimeout(() => {
getList()
getUserInfo()
startMusic('https://files.wanzhuanyongcheng.com/file/music/yaotouzi/3.mp3', true)
}, 2000)
}, rotateSpeed * 1000)
}
@@ -416,10 +417,12 @@ const getBetJl = () => {
Taro.useDidHide(() => {
ws.value?.close()
innerAudioContext.stop()
})
onBeforeUnmount(() => {
ws.value?.close()
innerAudioContext.stop()
})
</script>