更新页面效果

This commit is contained in:
李琦
2026-07-31 10:29:14 +08:00
parent 5f00b644cf
commit 3c4347128d
73 changed files with 1558 additions and 183 deletions

View File

@@ -62,6 +62,18 @@ export function useAudio() {
}
const play = () => playUrl(activeUrl.value)
// 尝试自动播放,返回是否成功(被浏览器拦截则返回 false由调用方决定是否弹授权框
const attemptAutoplay = async () => {
if (!activeUrl.value) return false
try {
await playUrl(activeUrl.value)
return isPlaying.value
} catch (e) {
return false
}
}
const pause = () => {
if (audio) audio.pause()
isPlaying.value = false
@@ -98,5 +110,5 @@ export function useAudio() {
}
})
return { isPlaying, isReady, tracks, activeUrl, currentName, setTracks, setActive, play, pause, toggle, armAutoplay }
return { isPlaying, isReady, tracks, activeUrl, currentName, setTracks, setActive, play, pause, toggle, attemptAutoplay, armAutoplay }
}