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

vue2.0 loops through the method of loading all images

php中世界最好的语言
Release: 2018-04-12 10:14:23
Original
4574 people have browsed it

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

Loading location of images:

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

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!

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