Home > Web Front-end > JS Tutorial > body text

How to implement loop traversal in vue2.0

php中世界最好的语言
Release: 2018-03-28 10:37:34
Original
1604 people have browsed it

This time I will bring you the loop of vue2.0How to implement the traversal, what are the notesfor implementing the loop traversal of vue2.0, the following is a practical case, let’s take a look one time.

demo:

    <p v-for="item in temps" :key="item.id">
     <p class="contract-item">
       <img :src="item.imgUrl">
     </p>
    </p>
Copy after login

Introduce picture, 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

Loading location of images:

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

This enables loading different images during loop traversal.

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:

The use of v-for index index in html

Sometimes the css reference image is found after packaging What is the reason why the resource file cannot be found?

The above is the detailed content of How to implement loop traversal in vue2.0. 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