소스 검색

fix: 点击音符设置mp3时间,js计算精度问题增加0.2毫秒误差范围

TIANYONG 9 달 전
부모
커밋
621093a010
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      src/pages/detail/helpers.ts

+ 3 - 0
src/pages/detail/helpers.ts

@@ -772,6 +772,9 @@ export const getIndex = (times: any[], currentTime: Number) => {
 		return state.times.length - 1;
 	}
 	let index = 0;
+  // js计算有精度问题,增加0.2毫秒误差范围
+  currentTime = Number(currentTime) + 0.0002;
+  // console.log('时间',currentTime)
 	for (let i = 0; i < times.length; i++) {
 		const item = times[i];
 		const prevItem = times[i - 1];