1***@qq.com
1***@qq.com
  • 发布:2023-07-26 18:25
  • 更新:2023-09-12 10:21
  • 阅读:199

【报Bug】微信真机调试时 bindmarkertap事件不见了

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 3.8.11

第三方开发者工具版本号: 1.06.2307250

基础库版本号: 2.25.3

项目创建方式: HBuilderX

示例代码:
<map id="myMap" style="width: 100vw; height: 100vh" :latitude="latitude" :longitude="longitude"  
        @markertap="clickMarkerPoint" :markers="markers" :polygons="polygons" :polyline="polyline"  
        :include-points="mini_points">  
    </map>

添加markers

this.markers.push({  
                                    id: i + 1,  
                                    width: 50,  
                                    height: 50,  
                                    latitude: res.data[i].lat,  
                                    longitude: res.data[i].lng,  
                                    iconPath: res.data[i].modelIcon  
                                });

点击事件(没触发)

clickMarkerPoint(e) {  
                console.log(e)  
                if (e && e.markerId) {  
                    if (e.markerId < 600000) {  
                        // 车  
                        this.bikeInfo = this.bikeList[e.markerId - 1]  
                        this.popupType = 1  
                        this.clickOpenModel()  
                    } else {  
                        // 停车区  
                        this.currentFence = this.fenceList[e.markerId - 1 - 600000]  
                        request.get('app/bs/fence/get/'+this.currentFence.id, {}).then((res) => {  
                            this.currentFence=res.data;  
                            this.convertPointToAddress(this.currentFence.centerPoint);  
                            this.getCurrentLocation();  
                            this.$refs.fencePopup.open();  
                        }).finally(()=>{  
                            uni.hideLoading();  
                        });  
                    }  
                }  
            },  

操作步骤:

模拟器没问题 , 点击真机调试或者上传体验版查看

关键代码

<map class="data-v-5744136d" id="myMap" style="width:100vw;height:100vh" latitude="{{i}}" longitude="{{j}}" bindmarkertap="{{k}}" markers="{{l}}" polygons="{{m}}" polyline="{{n}}" include-points="{{o}}"></map>
k: common_vendor.o((...args) => $options.clickMarkerPoint && $options.clickMarkerPoint(...args)),

预期结果:

map 组件的 bindmarkertap 事件能成功编译

实际结果:

点击后不触发clickMarkerPoint事件, 反而触发了页面中的随机一个按钮事件(按钮是处于uni-popup关闭状态的)

bug描述:

微信真机调试时 bindmarkertap事件不见了, 导致无法响应markers点击, 而且由于使用了uni-popup, 随机响应了一个 uni-popup内的点击事件(模拟器和支付宝真机都正常, 只有微信真机异常)

2023-07-26 18:25 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者)

原因很可能是 uni-popup 和 map 层级关系出问题

  1. uni-popup隐藏了以后, 点击map会被遮挡导致Marker点击事件不生效并且uni-popup上的随机一个点击事件生效
  2. 去除uni-popup后,map点击事件正常
  • 1***@qq.com (作者)

    写错了 是 uni-swiper-dot 这个控件有问题

    2023-08-01 17:13

1***@qq.com

1***@qq.com (作者)

已解决: 原因是微信BUG , swiper必须放在map代码下面

要回复问题请先登录注册