소스 검색

fix: dms格式修改

bill 1 년 전
부모
커밋
a50e3283b0
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      src/util/index.ts

+ 2 - 3
src/util/index.ts

@@ -68,14 +68,13 @@ export const numberSplice = (val: number) => {
 };
 
 //经纬度转度°分′秒″
-export const toDegrees = (val: number, retain = 4) => {
+export const toDegrees = (val: number, retain = 2) => {
   let temps = numberSplice(val);
   const d = temps[0];
   temps = numberSplice(temps[1] * 60);
   const m = temps[0];
   const s = round(temps[1] * 60, retain);
-
-  return `${d}°${m}′${s}"`;
+  return `${d}°${m}′${s.toFixed(2)}″`;
 };
 
 export const copyText = async (