new Vue({
el: '#app',
data(){
return {
group: [
{ id: 1, title: '', asrc: 'https://source.unsplash.com/collection/190727/120x120'},
{ id: 2, title: '', asrc: 'https://source.unsplash.com/collection/8961198/120x120'},
{ id: 3, title: '', asrc: 'https://source.unsplash.com/collection/190723/120x120'},
{ id: 4, title: '', asrc: 'https://source.unsplash.com/collection/KizanWcExgU/120x120'}
]
}
},
mounted(){
this.loadNextimage(-1)
},
methods:{
loadNextimage(currentIndex){
let nextIndex = currentIndex+1
if(nextIndex<this.group.length){
let img = this.group[nextIndex]
img.src = img.asrc
delete img.asrc
Vue.set(this.group,nextIndex,img)
}
}
}
});
img {
height: 120px;
width:120px;
}
img:not([src]){
background: url(https://www.slntechnologies.com/wp-content/uploads/2017/08/ef3-placeholder-image.jpg);
background-size:cover;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<div id="app">
<img
v-for="(image,index) in group" :key="index"
:src="image.src"
@load="loadNextimage(index)"
>
</div>