
image.png
1.引入依赖的SDK
import amap from '../../common/amap-wx.js';
2.初始话控件
var amapPluginInstance = new amap.AMapWX({
        key: '该key 是在高德中申请的微信小程序key'  //该key 是在高德中申请的微信小程序key
    });
3.获取当前位置的经纬度
onLoad() {
  this.getMyLocation();
}
//高德地图
            getMyLocation(){
                //amapPluginInstance
                let _self = this;
                amapPluginInstance.getRegeo({
                    success: (res) => {
                        console.log(res);//可自己查看所需返回值取用
                        _self.address = res[0].regeocodeData.formatted_address;
                        _self.lat = res[0].latitude; //纬度
                        _self.lng = res[0].longitude; //经度
                         uni.showModal({
                            title:"高德地图坐标",
                            content:"经纬度:["+ _self.lat+","+_self.lng+"]"
                         })
                    console.log("经纬度:["+ _self.lat+","+_self.lng+"]");
                },
                fail:(data)=>{
                    console.log(data)
                }
                })
            },










