Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
obtenga un archivo de audio de DOM y reprodúzcalo -- vuejs

Hola, estoy tratando de obtener el elemento de audio del dom y reproducirlo. El archivo de audio tendrá el mismo "id" que el botón.

Hasta ahora pude obtener la identificación del botón, pero cuando intento seleccionar el elemento por identificación, aparece un error.

Código:

 <script> export default { data() { return {}; }, methods: { play_audio(e) { //get button clicked const button = event.target.id; console.log(button); document.getElementById(button).play(); }, }, mounted() {}, }; </script> <template> <main> <div class="results"> <div class="result" v-for="(item, index) in cover_xl"> <div class="result_img"> <img :src="cover_xl[index]" :alt="title[index]" /> <button @click="play_audio" :id="preview[index]">Play</button> </div> <h2>{{ title[index] }}</h2> <audio :id="preview[index]"> <source :src="preview[index]" /> </audio> </div> </div> </main> </template>

Gracias por adelantado

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!