Home  >  Article  >  Web Front-end  >  How to implement loop traversal in vue2.0

How to implement loop traversal in vue2.0

php中世界最好的语言
php中世界最好的语言Original
2018-03-28 10:37:341534browse

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>

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";

Loading location of images:

 temps: [
    {
     imgUrl: con1
    },
    {
     imgUrl: con2
    },
    {
     imgUrl: con3
    },
   ],

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!

Statement:
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