uni-app 真机调试时 nvue 页面使用地图 markertap 和 tap 事件均无效 Vue 页面正常

uni-app 真机调试时 nvue 页面使用地图 markertap 和 tap 事件均无效 Vue 页面正常

开发环境 版本号 项目创建方式
Windows win7 HBuilderX

操作步骤:

<map name="" :style="{width:'375px',height:mapheight + 'px'}" :latitude="latitude"  
        :longitude="longitude" :markers="covers" :show-location="true" :controls="controls"  
        :include-points="includepoints" @markertap="movemap" @regionchange="moved" @controltap="location"  
        :scale="scale" :enable-satellite="satellite"></map>  

movemap(e) {  
        // console.log(e)  
        uni.showModal({  
            title:'提示',  
            content:JSON.stringify(e)  
        })  
}

预期结果:

  • 弹出modal

### 实际结果:

- movemap方法不执行,无弹框提示

bug描述:

真机调试,nvue页面使用地图,markertap和tap均无效,Vue页面正常


更多关于uni-app 真机调试时 nvue 页面使用地图 markertap 和 tap 事件均无效 Vue 页面正常的实战教程也可以访问 https://www.itying.com/category-93-b0.html

6 回复

貌似这个问题出现很久了。。官方貌似已经不想管这个了

更多关于uni-app 真机调试时 nvue 页面使用地图 markertap 和 tap 事件均无效 Vue 页面正常的实战教程也可以访问 https://www.itying.com/category-93-b0.html


你可以在map覆盖一透明层,点击后if去掉,然后再加上,这样就等于有了tap

3.1.8版本测试正常。看下markers内容怎么设置的

已解决,marker数量不能太多,我目前是根据地图视野动态加载了100个marker,点击事件是没问题的,之前几千个不行

nvue 下 点聚合开启 marker点击事件无效,请问怎么解决

在 nvue 页面中,地图组件的事件绑定机制与 Vue 页面存在差异。nvue 页面采用 Weex 原生渲染,事件绑定需通过 @event 语法实现,但部分事件可能需要使用原生事件绑定方式。

针对 markertap 事件无效的问题,可尝试以下解决方案:

  1. 检查事件绑定语法

    <map [@markertap](/user/markertap)="movemap" ...></map>
    

    确保事件名称拼写正确,且与官方文档一致。

  2. 使用 bind 前缀绑定事件(部分版本需兼容):

    <map bindmarkertap="movemap" ...></map>
    
  3. 确认 markers 数据格式

    • 确保 markers 数组中的每个对象包含有效的 id 字段,这是事件触发的必要条件。
    • 示例:
      covers: [{
        id: 1,
        latitude: 39.909,
        longitude: 116.39742,
        title: '位置标题'
      }]
回到顶部