微信小程序> 小程序map地图多点定位,导航

小程序map地图多点定位,导航

浏览量:662 时间: 来源:weixin_33918114

html

  map id="myMap" latitude="{{latitude}}"   longitude="{{longitude}}"   markers="{{markers}}"   show-location   bindmarkertap="selectMarket"  include-points="{{markers}}"/map复制代码

js

var app = getApp();Page({  data: {    latitude: 22.15792,  // latitude纬度    longitude: 113.564344, // longitude经度    markers:    [  {    id: 0,    latitude: 22.15792,    longitude: 113.564344,    name: '酒店1',    callout: {      content: " 酒店1  230元/晚",      padding: 10,      display: 'ALWAYS',      textAlign: 'center',      borderRadius: 10,      borderWidth: 1,    }  },  {    id: 1,    latitude: 22.164866,    longitude: 113.570039,    name: '酒店2',    callout: {      content: "酒店2",      padding: 10,      display: 'ALWAYS',      textAlign: 'center',      borderRadius: 10,      borderWidth: 1,    }  },  {    id: 2,    latitude: 22.162828,    longitude: 113.567883,    name: '酒店3',    callout: {      content: " 酒店3",      padding: 10,      display: 'ALWAYS',      textAlign: 'center',      borderRadius: 10,      borderWidth: 1,    }  },]  },  selectMarket: function (e) {    console.log(e)    var id = e.markerId    console.log(id)    wx.openLocation({      latitude: this.data.markers[id].latitude,      longitude: this.data.markers[id].longitude,      name: this.data.markers[id].name,    })  },  onLoad: function (options) {    // 这里请求接口  },});复制代码

最后

版权声明

即速应用倡导尊重与保护知识产权。如发现本站文章存在版权问题,烦请提供版权疑问、身份证明、版权证明、联系方式等发邮件至197452366@qq.com ,我们将及时处理。本站文章仅作分享交流用途,作者观点不等同于即速应用观点。用户与作者的任何交易与本站无关,请知悉。

产品经理

手机 : 13312967497

擅长 : 小程序流量变现

扫码领取礼包

最新资讯

热门模板

  • 头条
  • 搜狐
  • 微博
  • 百家
  • 一点资讯
  • 知乎