Переглянути джерело

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];