When I loop through an element, I have the following code:
<li v-for="file in lesson.files">
<a @click="sourceReplace()" class="copied" :id="file.file_id" :src=file.src>
{{file.name}}
</a>
</li>
I want to be able to click on this element and set the src of the clicked one to a variable called links
methods: {
sourceReplace(){
var currentVideo = document.getElementById('current-video');
var currentSource = document.getElementById('current-source');
var link = this.src;
currentSource.setAttribute('src', link);
currentVideo.setAttribute('src', link);
alert(link)
currentVideo.load();
currentVideo.play();
}
},
However, when I try to access the links variable, it returns undefined