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:
|
<<: Examples of MySQL and Python interaction
This article uses examples to illustrate the func...
Table of contents 1. Introduction to autofs servi...
We deal with Linux servers every day, especially ...
This article is original by 123WORDPRESS.COM Ligh...
npm installation tutorial: 1. Download the Node.j...
This article example shares the specific code of ...
Table of contents 1. Virtual Host 1.1 Virtual Hos...
Table of contents 1. World Map 1. Install openlay...
1. Dynamically loading scripts As the demand for ...
Preface When making a page, we often encounter co...
1. Introduction to KVM The abbreviation of kernel...
Fault description percona5.6, mysqldump full back...
Table of contents 1. Definition of stack 2. JS st...
Preface The previous article installed Hadoop, an...
Table of contents 1. Software and system image 2....