Vue's simple timer is for your reference. The specific contents are as follows Principle: setInterval is used to run the self-increment method every 1s (settable time interval), and clearInterval is used to stop the continuously running self-increment method to achieve the function of the timer. In the Vue part, the real-time refresh view function of Vue is used to display the value of the auto-increment variable on the front end. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Time</title> <script src="js/vue.js" type="text/javascript" charset="utf-8"></script> </head> <body> <div id="app"> <input type="button" name="" id="" value="Start" @click="start"/></br> <h1>{{number}}</h1> <input type="button" name="" id="" value="Pause" @click="stop"/></br> </div> <script type="text/javascript"> var vm = new Vue({ el:"#app", data:{ number:0 }, methods:{ start:function(){ time = setInterval(function(){ vm.number++ },1000) }, stop:function(){ clearInterval(time) } } }) </script> </body> </html> Rendering 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:
|
<<: MySQL dual-machine hot standby implementation solution [testable]
Because the Raspberry Pi is based on ARM architec...
1. Background that needs to be passed through CSS...
The drag function is mainly used to allow users t...
1. Download MySQL Community Server 5.6.35 Downloa...
It is not possible to use width and height directl...
Foreign Keys Query which tables the primary key o...
Introduction By enabling the slow query log, MySQ...
1. Unzip mysql-8.0.21-winx64 2. Configure environ...
After installing Navicat The following error may ...
Recently, I came across a webpage that had images ...
MySQL Bin log data recovery: accidentally delete ...
Table of contents 1. Operator 1.1 Arithmetic oper...
Table of contents 1. Effect diagram (multiple col...
This article shares with you the MySQL 8.0.17 ins...
The installation of MySQL 8.0.12 took two days an...