{"ast":null,"code":"export function getLocal(mapContext) {\n // 获取定位\n return new Promise();\n mapContext.plugin('AMap.Geolocation', function () {\n var geolocation = new AMap.Geolocation({\n enableHighAccuracy: true,\n // 是否使用高精度定位,默认:true\n timeout: 10000,\n // 设置定位超时时间,默认:无穷大\n offset: [10, 20],\n // 定位按钮的停靠位置的偏移量\n zoomToAccuracy: true,\n // 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false\n position: 'RB' // 定位按钮的排放位置, RB表示右下\n });\n\n let res;\n geolocation.getCurrentPosition(function (status, result) {\n if (status == 'complete') {\n res = result.position;\n // that.location = result.position\n // mapContext.setCenter()\n } else {\n alert(JSON.stringify(result));\n console.log(result);\n }\n });\n return res;\n });\n}","map":{"version":3,"names":["getLocal","mapContext","Promise","plugin","geolocation","AMap","Geolocation","enableHighAccuracy","timeout","offset","zoomToAccuracy","position","res","getCurrentPosition","status","result","alert","JSON","stringify","console","log"],"sources":["E:/work/sino/sino-h5/src/utils/map.js"],"sourcesContent":["export function getLocal(mapContext) { // 获取定位\r\n return new Promise()\r\n\r\n mapContext.plugin('AMap.Geolocation', function () {\r\n var geolocation = new AMap.Geolocation({\r\n enableHighAccuracy: true, // 是否使用高精度定位,默认:true\r\n timeout: 10000, // 设置定位超时时间,默认:无穷大\r\n offset: [10, 20], // 定位按钮的停靠位置的偏移量\r\n zoomToAccuracy: true, // 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false\r\n position: 'RB' // 定位按钮的排放位置, RB表示右下\r\n })\r\n let res;\r\n geolocation.getCurrentPosition(function(status, result){\r\n if(status == 'complete'){\r\n res = result.position\r\n // that.location = result.position\r\n // mapContext.setCenter()\r\n }else{\r\n alert(JSON.stringify(result))\r\n console.log(result)\r\n }\r\n });\r\n return res\r\n })\r\n}\r\n"],"mappings":"AAAA,OAAO,SAASA,QAAQA,CAACC,UAAU,EAAE;EAAK;EACxC,OAAO,IAAIC,OAAO,CAAC,CAAC;EAEpBD,UAAU,CAACE,MAAM,CAAC,kBAAkB,EAAE,YAAY;IAChD,IAAIC,WAAW,GAAG,IAAIC,IAAI,CAACC,WAAW,CAAC;MACrCC,kBAAkB,EAAE,IAAI;MAAE;MAC1BC,OAAO,EAAE,KAAK;MAAE;MAChBC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;MAAG;MACnBC,cAAc,EAAE,IAAI;MAAG;MACvBC,QAAQ,EAAE,IAAI,CAAC;IACjB,CAAC,CAAC;;IACF,IAAIC,GAAG;IACPR,WAAW,CAACS,kBAAkB,CAAC,UAASC,MAAM,EAAEC,MAAM,EAAC;MACrD,IAAGD,MAAM,IAAI,UAAU,EAAC;QACtBF,GAAG,GAAGG,MAAM,CAACJ,QAAQ;QACrB;QACA;MACF,CAAC,MAAI;QACHK,KAAK,CAACC,IAAI,CAACC,SAAS,CAACH,MAAM,CAAC,CAAC;QAC7BI,OAAO,CAACC,GAAG,CAACL,MAAM,CAAC;MACrB;IACF,CAAC,CAAC;IACF,OAAOH,GAAG;EACZ,CAAC,CAAC;AACJ"},"metadata":{},"sourceType":"module","externalDependencies":[]}