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 theirid
respectively - updated
toggle(id)
method, since you’re planning to change theplayState
, so i includeid
so theplayState
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 🙂
- [Vuejs]-Breaks on production mode in vue
- [Vuejs]-How can I hide Vue code in a non SPA Django and Vue project?
Source:stackexchange.com