微信小程序中实现地图导航

<map id="map" longitude="116.715790" latitude="23.362490" markers="{{markers}}"  

   scale="18"  style="width: 100%; height: 300px;" bindtap="click">  

</map>

click: function (e) {  
    wx.openLocation({  
      latitude: 23.362490,  
      longitude: 116.715790,  
      scale: 18,  
      name: '华乾大厦',  
      address:'金平区长平路93号'  
    })  
  },  

《微信小程序快速开发:视频指导版》第8章微网站中的地图为例,在map.wxml中增加bindtap="click",点击地图后跳转导航

在map.js中增加click事件

wx.openLocation为location API,作用为打开微信内置地图,点击后可调用内置地图进行导航,可以作为门店导航类使用。

转载地址:https://blog.csdn.net/u011330225/article/details/73556907

猜你喜欢

转载自blog.csdn.net/Bright2017/article/details/80774584