Below I will share with you a method of looping through and loading different images in vue2.0. It has a good reference value and I hope it will be helpful to everyone.
demo:
<p v-for="item in temps" :key="item.id"> <p class="contract-item"> <img :src="item.imgUrl"> </p> </p>
Introduce pictures, pay attention to the path:
import con1 from "@/assets/img/con01.png"; import con2 from "@/assets/img/con02.png"; import con3 from "@/assets/img/con03.png";
Load the image:
temps: [ { imgUrl: con1 }, { imgUrl: con2 }, { imgUrl: con3 }, ],
This enables loading different images during loop traversal.
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
How to implement random WeChat signal switching code through JavaScript (detailed tutorial)
Reload the current routing page according to AngularJS , what are the methods?
The above is the detailed content of Loop through and load different images in vue2.0 (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!