소스 검색

fix:优化 热点当前坐标经纬度 ,转为浮点型

jinx 3 년 전
부모
커밋
d99b9d1292
1개의 변경된 파일12개의 추가작업 그리고 7개의 파일을 삭제
  1. 12 7
      main.js

+ 12 - 7
main.js

@@ -80183,14 +80183,19 @@ and limitations under the License.
             if (this.filter.lon) throw new Error('location method can only be called once');
             var n = e.toArray();
          
-            if(typeof(n[0])=="string"){
-              n[0] = parseFloat(n[0])
-            }
-            if(typeof(n[1])=="string"){
-              n[1] = parseFloat(n[1])
-            }
+            // if(typeof(n[0])=="string"){
+            //   n[0] = parseFloat(n[0])
+            // }
+            // if(typeof(n[1])=="string"){
+            //   n[1] = parseFloat(n[1])
+            // }
             console.log('n[0]',n)
-            console.log('n[0].typeof',typeof(n[0]))
+            // console.log('n[0].typeof',typeof(n[0]))
+            for(let i =0;i<n.length;i++){
+                if(typeof(n[i])=="string"){
+                  n[i] = parseFloat(n[i])
+                }
+            }
             return (
               (this.filter.lon =typeof(n[0])=="number"? parseFloat(n[0].toFixed(t.FRACTION_DIGITS)): parseFloat(parseFloat(n[0]).toFixed(t.FRACTION_DIGITS))),
               (this.filter.lat = typeof(n[1])=="number"?parseFloat(n[1].toFixed(t.FRACTION_DIGITS)): parseFloat(parseFloat(n[1]).toFixed(t.FRACTION_DIGITS))),