效果图
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/109625d9c44d9e8a6a4bdf2d63dcb681.png)
当前时间
var now = new Date();
var year = now.getFullYear();
var month = (now.getMonth() +1) <10 ? "0"+(now.getMonth() +1) : (now.getMonth() +1);
var day = now.getDate() <10 ? "0"+now.getDate() : now.getDate()
var hour = now.getHours() <10 ? "0"+now.getHours() : now.getHours()
var minute = now.getMinutes() <10 ? "0"+now.getMinutes() : now.getMinutes()
var second = now.getSeconds() <10 ? "0"+now.getSeconds() : now.getSeconds()
// console.log("当前时间",year+"-"+month+"-"+day+" "+ hour+":"+minute+":"+second);