html页面动态显示时间
思路:使用setInterval一直调用获取当前时间方法
setInterval(getCurrentTime, 1000)
getCurrentTime () {
let now = new Date ();
let hh = now.getHours();
let mm = now.getMinutes() > 10 ? now.getMinutes() : \'0\'+now.getMinutes();
let ss = now.getSeconds() > 10 ? now.getSeconds() : \'0\'+ now.getSeconds();
this.currentTime = hh + \':\' + mm + \':\' + ss
}