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

Windows cannot start MySQL service and reports error 1067 solution

Suddenly when I logged into MySQL, it said that a...

Docker deploys mysql to achieve remote connection sample code

1.docker search mysql查看mysql版本 2. docker pull mys...

How to implement one-click deployment of nfs in linux

Server Information Management server: m01 172.16....

Commonly used HTML format tags_Powernode Java Academy

1. Title HTML defines six <h> tags: <h1&...

Summary of seven MySQL JOIN types

Before we begin, we create two tables to demonstr...

Detailed explanation of sshd service and service management commands under Linux

sshd SSH is the abbreviation of Secure Shell, whi...

Explanation of MySQL's horizontal and vertical table partitioning

In my previous article, I said that the optimizat...

JavaScript imitates Xiaomi carousel effect

This article is a self-written imitation of the X...

Detailed explanation of how Node.js middleware works

Table of contents What is Express middleware? Req...

About the problems of congruence and inequality, equality and inequality in JS

Table of contents Congruent and Incongruent congr...

Detailed explanation of creating stored procedures and functions in mysql

Table of contents 1. Stored Procedure 1.1. Basic ...

Summary of HTML horizontal and vertical centering issues

I have encountered many centering problems recent...

How to implement responsiveness in Vue source code learning

Table of contents Preface 1. Key Elements of a Re...

vmware virtual machine ubuntu18.04 installation tutorial

Installation Steps 1. Create a virtual machine 2....