fps()
let lastTime ;
let count = 0;
function fps(){
count++
//performance.now() 相比 Date.now()更加准确
if(!lastTime)lastTime = performance.now()
if(performance.now() - lastTime > 1000){
vm.fps = count
lastTime = performance.now()
count = 0
}
添加至动画循环antimate
requestAnimationFrame执行帧是根据电脑屏幕刷新自适应 ,本人电脑屏幕刷新率144hz计算出fps就在144左右