const aaaa = () => { const startTime = new Date(resdata.data.nextGame.opentime); const endTime = new Date(resdata.data.nextGame.now); resdata.shijian = Math.floor((endTime.getTime() - startTime.getTime()) / 1000); }; 每秒执行一次
你可以使用 setInterval() 函数来实现每秒执行一次的功能。可以将 aaaa 函数作为 setInterval() 的回调函数,并将时间间隔设置为 1000 毫秒。
例如:
setInterval(aaaa, 1000);
这将在每秒钟执行一次 aaaa 函数。
原文地址: http://www.cveoy.top/t/topic/fWG 著作权归作者所有。请勿转载和采集!