Vue+js click arrow to switch pictures

Vue+js click arrow to switch pictures

This article example shares the specific code of Vue+js clicking the arrow to switch pictures for your reference. The specific content is as follows

The front-end requirement is that the returned image data can be switched by clicking the arrow

The code is as follows

 <div class="pubuItemsBox">
        <!-- Modifications to the evening of 5.23 -->
        <template v-for="(orderEvent, index) in orderEventList" >
          <div :class="{'pubuItem':true, 'noMag':(index+1)%3 == 0}">
            <div class="imgDivs">
              <template v-if="orderEvent.eventFocuspic.split(',').length > 1">
                <ins class="left" @click='change(index,"prev")'></ins>
                <ins class="right" @click='change(index,"next")'></ins>
              </template>
              <ul class="ulZpImg">
                <template v-for="(imgUrl,imgUrlIndex) in orderEvent.eventFocuspic.split(',')" >
                  <li v-show='imgUrlIndex===orderEvent.mark'><img :src="getImageUrl(showImg(imgUrl))"></li>
                </template>
              </ul>
            </div>
            <div class="txtBox">
              <span>{{orderEvent.brandName}}</span><ins>Date: {{orderEvent.beginDate}} to {{orderEvent.endDate}}</ins>
            </div>
            <p style="-webkit-box-orient: vertical;">{{orderEvent.eventDesc}}</p>
          </div>
        </template>
      </div>
 
 
<script>
change(i, type){
        var obj = this.orderEventList[i];
        var imgLength =obj.eventFocuspic.split(',').length;
        if (type === "prev") {
          if (obj.mark == 0) {
            obj.mark = imgLength - 1
            return
          }
          obj.mark--;
        }
        if (type === "next") {
          if (obj.mark == imgLength - 1) {
            obj.mark = 0
            return
          }
          console.log(obj.mark)
          obj.mark++;
        }
      }
</script>

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to implement the Vue mouse wheel scrolling switching routing effect
  • Vue implements scrolling the mouse wheel to switch pages
  • Vue uses swiper to switch pictures by sliding left and right
  • Vue implements button switching picture
  • Vue custom js picture fragment carousel switching effect implementation code
  • Vue realizes picture switching effect
  • Vue implements switching function between base64 encoded images
  • Detailed explanation of the use of Vue card-style click-to-switch image component
  • Vue implements simple image switching effect
  • Vue implements mouse hover to switch image src

<<:  Modify file permissions (ownership) under Linux

>>:  Viewing and analyzing MySQL execution status

Recommend

Tutorial on installing and using virtualenv in Deepin

virtualenv is a tool for creating isolated Python...

When is it appropriate to use dl, dt, and dd?

dl:Definition list Definition List dt:Definition t...

How to recover data after accidentally deleting ibdata files in mysql5.7.33

Table of contents 1. Scenario description: 2. Cas...

HTML+CSS div solution when relative width and absolute width conflict

Div solution when relative width and absolute wid...

How to use ElementUI pagination component Pagination in Vue

The use of ElementUI paging component Pagination ...

How to configure eureka in docker

eureka: 1. Build a JDK image Start the eureka con...

How to view available network interfaces in Linux

Preface The most common task after we install a L...

Example code of the spread operator and its application in JavaScript

The spread operator allows an expression to be ex...

html opens a new window with a hyperlink and can control window properties

1. The window size opened by the HTML hyperlink C...

MySQL database rename fast and safe method (3 kinds)

Table of contents How to rename MySQL database Th...

Use tomcat to deploy SpringBoot war package in centos environment

Prepare war package 1. Prepare the existing Sprin...

Windows 10 is too difficult to use. How to customize your Ubuntu?

Author | Editor Awen | Produced by Tu Min | CSDN ...

How to start and restart nginx in Linux

Nginx (engine x) is a high-performance HTTP and r...

What do CN2, GIA, CIA, BGP and IPLC mean?

What is CN2 line? CN2 stands for China Telecom Ne...