地图上展示marker,marker上展示气泡callout,因展示的内容太多,使用的自定义callout,参照文档里提供的demo,实现了,我想要的效果,但是点击事件没反应,请问如何处理?
<view>
<map class="home-map" scale="{{currentScale}}" longitude="{{currentLongitude}}" latitude="{{currentLatitude}}" markers="{{markers}}" bindtap="bindtapmap" bindmarkertap="bindmarkertap" show-location="true">
<cover-view slot="callout">
<block wx:for="{{customCalloutMarkerIds}}" wx:key="*this">
<cover-view class="customCallout" marker-id="{{item}}" >
<cover-view class="content" >
<cover-view bindtap="trackPlayBack">车牌号{{currentMarker.id}}</cover-view>
<cover-view>车牌号{{currentMarker.name}}</cover-view>
<cover-view>车牌号{{currentMarker.latitude}}</cover-view>
<cover-view>车牌号{{currentMarker.longitude}}</cover-view>
<cover-view>车牌号{{currentVehicle}}</cover-view>
</cover-view>
</cover-view>
</block>
</cover-view>
</map>
</view>
trackPlayBack(){
console.log(111111)
wx.navigateTo({
url: '/pages/trackPlayBack/trackPlayBack',
})
}
找到方案了,在map上绑定
bindcallouttap:点击标记点对应的气泡时触发e.detail = {markerId}
https://blog.csdn.net/weixin_46561899/article/details/135544026
大佬这个问题解决了吗
你用了气泡的插槽,就只能用气泡的点击事件了啊
bindcallouttap
bindcallouttap 使用这个代替试试呢?
https://developers.weixin.qq.com/miniprogram/dev/component/cover-view.html