[Vuejs]-Play specific video from loop OnClick in Vue.JS

0👍

Converting comment to answer for future reference

My working fiddle version: https://jsfiddle.net/jfpwtkm0/1
Feel free share your thoughts:

  • I used v-for since your HTML on video with duplicate id was weird as it would be practical in actual video datafetching case instead of manual-templating each video
  • Custom directive was not mapped to each Object’s playing state, so i’ve changed that format to be assigned to video with their id respectively
  • updated toggle(id) method, since you’re planning to change the playState, so i include id so the playState of videoObject toggled according the index.
  • Same id value in multiple elements is not practical. I assigned the id of the videoArray to be unique.

If this answer solved your question, green tick will help alot, cheers 🙂

Leave a comment