<script type="text/javascript" >var weizhi='{$weizhi}';if(!weizhi){ var geolocation = new BMap.Geolocation(); // 創建地理編碼實例 var myGeo = new BMap.Geocoder(); geolocation.getCurrentPosition(function(r) { if (this.getStatus() == BMAP_STATUS_SUCCESS) { var pt = r.point; // 根據坐標得到地址描述 myGeo.getLocation(pt, function(result) { console.log(result); if (result) { var addComp = result.addressComponents; } }); } });}</script>報錯getCurrentPosition() and watchPosition() are deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
獲取當前地理位置js方法?
達令說
2018-10-25 14:15:34