From 853db1af9ca46bfbf53eeb1ab848de4c78b6dd68 Mon Sep 17 00:00:00 2001 From: "Mr.jiang" <714156421@qq.com> Date: Tue, 13 Aug 2024 20:51:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/webMap.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/utils/webMap.js b/utils/webMap.js index 24b2fc0..4abc785 100644 --- a/utils/webMap.js +++ b/utils/webMap.js @@ -69,7 +69,25 @@ export function addMarker(map,pointMap,orderList,clickCellBack){ } }); } - +export function amapLocations(map){ +AMap.plugin('AMap.Geocoder', function() { + var geocoder = new AMap.Geocoder({ + enableHighAccuracy: true, + }); + var lnglat = [125.433131,43.878774]; + + geocoder.getAddress(lnglat, function (status, result) { + if (status === "complete" && result.info === "OK") { + // result为对应的地理位置详细信息 + console.log('result=================.',result); + return result; + }else{ + console.error('定位失败','失败原因排查信息:'+result.message+result.originMessage); + return result.message; + } + }); +}); +} export function amapLocation(map){ AMap.plugin('AMap.Geolocation', function() { var geolocation = new AMap.Geolocation({