Explorar o código

fix: dms格式修改

bill hai 1 ano
pai
achega
a50e3283b0
Modificáronse 1 ficheiros con 2 adicións e 3 borrados
  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 (