@@ -53,9 +53,10 @@ import "1llest-waveform-vue/lib/style.css"
5353``` vue
5454<template>
5555 <IllestWaveform
56- ref="waveform_ref "
56+ ref="waveformRef "
5757 v-bind="waveOptions"
5858 @on-init="initHandler"
59+ @on-fetched="fetchedHandler"
5960 @on-ready="readyHandler"
6061 @on-play="(v: boolean) => (playing = v)"
6162 @on-pause="(v: boolean) => (playing = v)"
@@ -76,13 +77,14 @@ import "1llest-waveform-vue/lib/style.css"
7677 url: "example.mp3"
7778 })
7879
79- const waveform_ref = ref<typeof IllestWaveform | null>(null)
80+ const waveformRef = ref<typeof IllestWaveform | null>(null)
8081
8182 onMounted(() => {
8283 getCurrentTime()
8384 })
8485
8586 const init = ref(false)
87+ const fetched = ref(false)
8688 const playing = ref(false)
8789 const finished = ref(false)
8890 const ready = ref(false)
@@ -92,6 +94,10 @@ import "1llest-waveform-vue/lib/style.css"
9294 const initHandler = (v: boolean) => {
9395 init.value = v
9496 }
97+
98+ const fetchedHandler = (v: boolean) => {
99+ fetched.value = v
100+ }
95101
96102 const readyHandler = (v: boolean) => {
97103 ready.value = v
@@ -107,26 +113,26 @@ import "1llest-waveform-vue/lib/style.css"
107113 }
108114
109115 const play = () => {
110- waveform_ref .value!.play()
116+ waveformRef .value!.play()
111117 }
112118
113119 const replay = () => {
114- waveform_ref .value!.replay()
120+ waveformRef .value!.replay()
115121 }
116122
117123 const pause = () => {
118- waveform_ref .value!.pause()
124+ waveformRef .value!.pause()
119125 }
120126
121127 const getCurrentTime = () => {
122128 watchEffect(() => {
123- const current = waveform_ref .value!.getCurrentTime()
129+ const current = waveformRef .value!.getCurrentTime()
124130 currentTime.value = current
125131 })
126132 }
127133
128134 const getDuration = () => {
129- const duration = waveform_ref .value!.getDuration()
135+ const duration = waveformRef .value!.getDuration()
130136 durationTime.value = duration
131137 }
132138</script>
0 commit comments