I am encountering an issue with my code. Initially, :src="labels[index]"
was working fine for me. However, as my codebase expanded, I needed to use ${app.labels[index]}
. Simply using ${app.labels}
works, but the addition of [index]
causes it to break. Can someone guide me on how to correctly add that inside the brackets?
new Vue({
el: "#app",
data: {
images: [],
labels: [],
form: {
dir: "",
fileItems: [] // An array containing objects of type: {id: number, file: File, dataUrl: [base64 encoded file string], caption: string'}
},
},
methods: {
toggle: function(todo){
todo.done = !todo.done
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<h2>Todos:</h2>
<div class="image-wrap"><img style="max-height: 430px;" :src="${app.labels[index]}" /></div>
</div>