安卓小程序 Map 组件 bindtap 无效
微信版本:6.5.16.1120
基础库版本:1.6.3(2017.10.20 15:03:22)
安卓小程序 Map 组件绑定点击事件无效,iPhone 没问题
8 回复
试了一下,是地图有 marker 时,绑定地图本身(非 marker)的点击事件,不会触发。下面是可复现代码:
< map longitude = "{{longitude}}" latitude = "{{latitude}}" markers = "{{markers}}" bindtap = "maptap" ></ map > |
Page({ data: { longitude: 116.39750, latitude: 39.90871, markers: [{ longitude: 116.39750, latitude: 39.90871, iconPath: './marker.png' , width: 32, height: 40 }] }, maptap() { wx.showToast({ title: 'fire' }); } }); |
先看下我的,官方提供的示例代码,在iphone6s上点击Marker,很难响应事件,点很多次才能响应一次
<!-- map.wxml --><map id=“map” longitude=“113.324520” latitude=“23.099994” scale=“14” controls="{{controls}}" bindcontroltap=“controltap” markers="{{markers}}" bindmarkertap=“markertap” polyline="{{polyline}}" bindregionchange=“regionchange” show-location style=“width: 100%; height: 300px;”></map>
// map.jsPage({
data: {
markers: [{
iconPath: "/resources/others.png",
id: 0,
latitude: 23.099994,
longitude: 113.324520,
width: 50,
height: 50
}],
polyline: [{
points: [{
longitude: 113.3245211,
latitude: 23.10229
}, {
longitude: 113.324520,
latitude: 23.21229
}],
color:"#FF0000DD",
width: 2,
dottedLine: true
}],
controls: [{
id: 1,
iconPath: '/resources/location.png',
position: {
left: 0,
top: 300 - 50,
width: 50,
height: 50
},
clickable: true
}]
},
regionchange(e) { console.log(e.type)
},
markertap(e) { console.log(e.markerId)
},
controltap(e) { console.log(e.controlId)
}
})