微信小程序demo:滴滴拉粑粑,地图api自定义覆盖物
点评:滴滴拉粑粑,用于学习地图上自定义覆盖物Page({
data: {
height: 0,
center: ,
markers: []
},
regionchange(e) {
console.log(e.type)
},
markertap(e) {
console.log(e)
let mark = {}
this.data.markers.map((ele)=>{
if(ele.id == e.markerId)
mark = ele
})
wx.navigateTo({
url:'../logs/logs?lat='+mark.latitude+'&lng='+mark.longitude+'&address='+mark.address+'&distance='+mark._distance
})
return
wx.showModal({
title: '厕所地址',
content: mark.address+' ('+mark._distance.toFixed(0)+'m)',
showCancel: false,
success: function(res) {
if (res.confirm) {
console.log('用户点击确定')
}
}
})
},
onLoad() {
const system = wx.getSystemInfoSync()
this.setData({
height: system.windowHeight
})
wx.getLocation({
type: 'wgs84',
success: (res) => {
this.setData({
center:
})
console.log(res.longitude, res.latitude)
wx.request({
url: 'https://api.getweapp.com/vendor/qqmap/search/toilet',
data: {
lat: res.latitude,
lng: res.longitude,
page: 1
},
success:(res)=>{
res.data.data.map((e)=>{
e.iconPath = "/images/matong.png"
e.width = 50
e.height = 50
e.latitude = e.location.lat
e.longitude = e.location.lng
})
this.setData({
markers: res.data.data
})
console.log(res.data.data)
}
})
}
})
}
})
<map id="map" longitude="{{center}}" latitude="{{center}}" scale="14" markers="{{markers}}" bindmarkertap="markertap"show-location style="width: 100%; height: {{height}}px;"></map>
**** Hidden Message *****
啥也不说了,感谢楼主分享哇!:) 参考学习 感谢分享 谢谢楼主了!!! 先感谢分享 先感谢分享 213333333333333333333 我有流量,你有产品,我们就可以合作,有意的个人开发者朋友可以联系微信号jim20180688,详聊
页:
[1]