Home > Web Front-end > JS Tutorial > Loop through and load different images in vue2.0 (detailed tutorial)

Loop through and load different images in vue2.0 (detailed tutorial)

亚连
Release: 2018-06-01 10:35:14
Original
3117 people have browsed it

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>
Copy after login

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";
Copy after login

Load the image:

 temps: [
    {
     imgUrl: con1
    },
    {
     imgUrl: con2
    },
    {
     imgUrl: con3
    },
   ],
Copy after login

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:

In the bottom navigation bar in vue.js, how to display the first-level route and the solution to the problem that the sub-route is not displayed?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template