时间:2021-04-21 09:37:57 | 栏目:vue | 点击:次
demo:
<div v-for="item in temps" :key="item.id"> <div class="contract-item"> <img :src="item.imgUrl"> </div> </div>
引入图片,注意路径:
import con1 from "@/assets/img/con01.png"; import con2 from "@/assets/img/con02.png"; import con3 from "@/assets/img/con03.png";
进行图片的加载位置:
temps: [ { imgUrl: con1 }, { imgUrl: con2 }, { imgUrl: con3 }, ],
这样就实现了循环遍历的时候加载不同的图片。