This time I will bring you vue2.0loopmethod to traverse and load all images, vue2.0 loop to load all imagesnotesare Which ones, the following are practical cases, let’s take a look.
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";
Loading location of images:
temps: [ { imgUrl: con1 }, { imgUrl: con2 }, { imgUrl: con3 }, ],
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!
Recommended reading:
Introduction to project structure and configuration of vuex
After upgrading vue-cli 3.0.x to webpack4 What are the new features
The above is the detailed content of vue2.0 loops through the method of loading all images. For more information, please follow other related articles on the PHP Chinese website!