VUE implements timeline playback component

VUE implements timeline playback component

This article example shares the specific code of VUE to implement the timeline playback component for your reference. The specific content is as follows

Let's take a look at the renderings first.

1. The effect of initialization!

2. You can drag and drop, and put the mouse on it to display the time

3. After pressing the play button, the two horizontal lines on the left and right can go to the previous page or the next page.

Here are the steps for VUE access:

1. Introduce js and css files in index.html

<script src='../static/js/timePlay.js'></script>
<link href='../static/css/timePlay.css' rel='stylesheet'/>

2. Write a time control component TimePlay.vue

<template>
  <div>
    <div class="time-content" id="timePlay"></div>
  </div>
</template>

<script>
var timeplay = "";
export default {
  data() {
    return {};
  },
  methods: {
    initTimePlay() {
      let _this = this;
      $("#timePlay").html("");
      timeplay = new TimePlay({
        selectDate: _this.$store.state.trackPlayback.currentSelectDate,
        onClickChangeEnd: function () {
          //Callback after clicking},
        onAnimateEnd: function () {
        //Callback every time the timeline animation ends},
      });
      //Initialize the timeline date var curr_date = new Date(timeplay.options.selectDate);
      var hour = curr_date.getHours();
      var minute = curr_date.getMinutes();
      var second = curr_date.getSeconds();
      timeplay.options.startDate = parseInt(
        "" +
          (hour > 9 ? hour : "0" + hour) +
          (minute > 9 ? minute : "0" + minute) +
          (second > 9 ? second : "0" + second)
      );
      timeplay.options.endDate = parseInt(
        "" +
          (hour + 1 > 9 ? hour + 1 : "0" + (hour + 1)) +
          (minute > 9 ? minute : "0" + minute) +
          (second > 9 ? second : "0" + second)
      );
      $("#pause").click(function () {
        timeplay.delayAnimation(); //delay animation});

      $("#play").click(function () {
        console.log("Start playing")
        timeplay.continueAnimation(); //Continue animation});
      //Click to pause execution$(".play").click(function () {
      });
    },
  },
  mounted() {
    this.initTimePlay();
    window.timePlayLeft = $(".timeProgress-box").offset().left;
  },
  }
</script>

<style>
</style>

3. Normal parent component call

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
  • How to draw the timeline with vue+canvas
  • Vue.js implements timeline function
  • Vue+swiper realizes timeline effect
  • Vue realizes the logistics timeline effect
  • Vue timeline vue-light-timeline usage instructions
  • Vue implements movable horizontal timeline
  • Vue implements timeline effect

<<:  Examples of MySQL and Python interaction

>>:  What is WML?

Recommend

Analysis of mysql view functions and usage examples

This article uses examples to illustrate the func...

Linux Autofs automatic mount service installation and deployment tutorial

Table of contents 1. Introduction to autofs servi...

How to monitor Linux server status

We deal with Linux servers every day, especially ...

Web page creation question: Image file path

This article is original by 123WORDPRESS.COM Ligh...

Detailed explanation of node.js installation and HbuilderX configuration

npm installation tutorial: 1. Download the Node.j...

JS implements circular progress bar drag and slide

This article example shares the specific code of ...

In-depth analysis of Nginx virtual host

Table of contents 1. Virtual Host 1.1 Virtual Hos...

Vue uses openlayers to load Tiandi Map and Amap

Table of contents 1. World Map 1. Install openlay...

HTML dynamically loads css styles and js scripts example

1. Dynamically loading scripts As the demand for ...

Detailed explanation of 5 solutions for CSS intermediate adaptive layout

Preface When making a page, we often encounter co...

Detailed explanation of JavaScript stack and copy

Table of contents 1. Definition of stack 2. JS st...

Detailed tutorial on installing Hbase 2.3.5 on Vmware + Ubuntu18.04

Preface The previous article installed Hadoop, an...

VMware installation of Centos8 system tutorial diagram (Chinese graphical mode)

Table of contents 1. Software and system image 2....