let myTimer = setTimeout( () => {
if (diffTimer > 0) {
hours = Math.floor(diffTimer/3600);
minutes = Math.floor((diffTimer/60)%60);
seconds = Math.floor(diffTimer%60);
this.hours = hours > 9 ? hours : '0' + hours;
this.minutes = minutes > 9 ? minutes : '0' + minutes;
this.seconds = seconds > 9 ? seconds : '0' + seconds;
} else {
clearTimeout(myTimer);
}
diffTimer--;
setTimeout(arguments.callee,1000);
},1000)
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
使用箭头函数不可以使用arguments对象,该对象在函数体内不存在。如果要用,可以用Rest参数代替。