?## 计算当前毫秒数:
const [start,setStart] = useState(new Date().getTime())
useEffect(()=>{
setInterval(()=>{
setCurrMill(new Date().getTime()-start)
},1)
},[])
## 格式化毫秒?
function formatMilliseconds(milliseconds) {
const totalSeconds = Math.floor(milliseconds / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
const centiseconds = Math.floor((milliseconds % 1000) / 10);
const formattedTime =
(minutes < 10 ? '0' : '') +
minutes +
':' +
(seconds < 10 ? '0' : '') +
seconds +
'.' +
(centiseconds < 10 ? '0' : '') +
centiseconds;
return formattedTime;
}
## 显示:?