fix: clear old subtitle cues when switching to scene without subtitles

Previously when subtitleUrl became null, the old cues array was retained
and would replay from the beginning on the next scene.
This commit is contained in:
2026-06-07 21:22:45 +08:00
parent a34d787336
commit 65c26e0972

View File

@@ -17,7 +17,13 @@ const currentText = ref('')
const loadedUrl = ref('')
watch(() => props.subtitleUrl, async (url) => {
if (!url || url === loadedUrl.value) return
if (!url) {
cues.value = []
currentText.value = ''
loadedUrl.value = ''
return
}
if (url === loadedUrl.value) return
loadedUrl.value = url
try {
const resp = await fetch(url)