Vue+swiper realizes timeline effect

Vue+swiper realizes timeline effect

This article shares the specific code of vue+swiper to achieve the timeline effect for your reference. The specific content is as follows

Effect:

First, if you have a Taobao image, use cnpm install swiper --save. If you don't have a Taobao image, use npm install swiper --save.

<template>
  <div class="hello" style="height:100%;width:100%;position:relative;">
    <div class="swiperlist">
      <div class="swipers">
        <div class="swiper-container">
          <div class="swiper-wrapper">
            <div class="swiper-slide" v-for="(activity, index) in superurl" :key="index">
              <div style="padding-left: 4px;">
                <div class="step-line"></div>
                <div class="step-content">
                  <div class="step-num"></div>
                  <div class="sub_title">{{activity.img}}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="buttom" v-if="superurl.length>2">
          <div class="swiper-button-prev"></div>
          <div class="swiper-button-next"></div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import Swiper from "swiper";
import "../../../../../node_modules/swiper/css/swiper.min.css";
import baseMap from "./baseMap.vue";
import "../../../../../static/mapbox/css/map.css";
export default {
  name: "Map",
  components:
    baseMap
  },
  data() {
    return {
      superurl: [
        {
          url: "",
          img: "2019-01"
        },
        {
          url: "",
          img: "2019-02"
        },
        {
          url: "",
          img: "2019-03"
        },
        {
          url: "",
          img: "2019-04"
        },
        {
          url: "",
          img: "2019-05"
        },
        {
          url: "",
          img: "2019-06"
        }
      ]
    };
  },
  watch: {},
  methods: {},
  mounted() {
    var mySwiper = new Swiper(".swiper-container", {
      slidesPerView: 3, //Show three slides centeredSlides: true, //When set to true, the active slide will be centered instead of the default left.
      centerInsufficientSlides: true, //Turn on this parameter. When the total number of slides is less than slidesPerView, the slides are centered. Does not apply to loop mode and slidesPerColumn
      centeredSlidesBounds: true, //Make the first and last Slide always fit the edge.
      // loop: true, // loop // autoplay: true, // autoplay direction: "vertical", // vertical screen navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev"
      }
    });
  }
};
</script>
<style scoped>
.swiperlist {
  width: 90px;
  height: 256px;
  position: absolute;
  background: #f5f5f5;
  left: 5px;
  top: 205px;
  overflow: hidden;
  padding: 32px 0;
  border-radius: 6px;
}
.swipers {
  width: 100%;
  height: 250px;
  overflow: hidden;
}
.swiper-container {
  height: 250px !important;
}
.swiper-slide-active {
  color: #3a70ca;
}
.swiper-button-prev,
.swiper-container-rtl .swiper-button-next {
  left: 28px;
  right: auto;
  top: 15px;
  transform: rotate(90deg);
  color: #3a70ca;
}
.swiper-button-next,
.swiper-container-rtl .swiper-button-prev {
  top: 94%;
  transform: rotate(90deg);
  left: 28px;
  color: #3a70ca;
}
.swiper-button-next:after,
.swiper-button-prev:after {
  font-size: 25px;
}
.sub_title {
  margin-left: 15px;
  margin-top: -19px;
}
.step-num {
  display: inline-block;
  height: 2px;
  width: 2px;
  color: #fff;
  background-color: #3a70ca;
  line-height: 30px;
  border-radius: 50%;
  text-align: center;
  border: 2px solid #3a70ca;
  margin-top: 36px;
}
.step-num:after {
  content: "";
  width: 2px;
  height: 84px;
  border-left: 1.5px dotted #3a70ca;
  /* background-color: #3a70ca; */
  position: absolute;
  top: 0px;
  margin-left: -1px;
}
</style>

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:
  • Vue implements horizontal timeline
  • Vue implements timeline function
  • Vue sample code for implementing two-column horizontal timeline
  • VUE implements timeline playback component
  • How to draw the timeline with vue+canvas
  • Vue.js implements timeline function
  • Vue realizes the logistics timeline effect
  • Vue timeline vue-light-timeline usage instructions
  • Vue implements movable horizontal timeline
  • Vue implements timeline effect

<<:  Detailed examples of Zabbix remote command execution

>>:  Summary of some small issues about MySQL auto-increment ID

Recommend

Summary of Common Commands for Getting Started with MySQL Database Basics

This article uses examples to describe the common...

Limit input type (multiple methods)

1. Only Chinese characters can be input and pasted...

Calling the search engine in the page takes Baidu as an example

Today, it suddenly occurred to me that it would be...

MySQL 8.0.20 winx64 installation and configuration method graphic tutorial

This article shares with you the installation and...

Detailed explanation of MySQL database (based on Ubuntu 14.0.4 LTS 64 bit)

1. Composition and related concepts of MySQL data...

Troubleshooting of master-slave delay issues when upgrading MySQL 5.6 to 5.7

Recently, when upgrading the Zabbix database from...

JavaScript Sandbox Exploration

Table of contents 1. Scenario 2. Basic functions ...

Tutorial on installing jdk1.8 on ubuntu14.04

1. Download jdk download address我下載的是jdk-8u221-li...

How to deploy services in Windows Server 2016 (Graphic Tutorial)

introduction Sometimes, if there are a large numb...

How to install MySQL for beginners (proven effective)

1. Software Download MySQL download and installat...

How to use DCL to manage users and control permissions in MySQL

DCL (Data Control Language): Data control languag...