diff --git a/src/pages/vocabulary/index.vue b/src/pages/vocabulary/index.vue index acc6188..fb1a057 100644 --- a/src/pages/vocabulary/index.vue +++ b/src/pages/vocabulary/index.vue @@ -90,10 +90,14 @@ document.addEventListener('keydown', (ev) => { } }) +let audio = null function play(audioPath) { - const audio = document.createElement('audio') + if (audio) { + audio.pause() + audio.currentTime = 0 + } + audio = document.createElement('audio') audio.src = audioPath - console.log(audioPath) audio.play() }