uniapp 引入高德地图

引入步骤 首先
(1)需要在高德开发平台注册成为开发者
地址:
https://lbs.amap.com/
(2) 在控制台里面创建应用 申请获取Key
(3)下载微信小程序的SDK代码 引入项目中
在这里插入图片描述
(4)在自己需要的页面引入

    import amap from '../../../js_sdk/js_amap/amap-wx.130';

(5) 在需要加载地图的地方加入

 <map class="map-layout"
             :latitude="latitude"
             :longitude="longitude"
             scale="14"
             :markers="markers"
             :show-location="true"
             @markertap="markertap"
             @updated='mapUpdated'>
        </map>

latitude/longitude --经纬度
在代码中 加入

         var amapPluginInstance = new amap.AMapWX({
    
    	
				key: 你高德地图应用获取的key  //该key 是在高德中申请的微信小程序key
			});
		   amapPluginInstance.getPoiAround({
    
    
		      success: function(data){
    
    
		        //成功回调
		      },
		      fail: function(info){
    
    
		        //失败回调
		        console.log(info)
		      }
		    })
```![在这里插入图片描述](https://img-blog.csdnimg.cn/d9a4f5f8a15d483ebca70ea0e405b5dc.jpeg#pic_center)


        





猜你喜欢

转载自blog.csdn.net/qq_36158551/article/details/130454407