magao
magao
  • 发布:2021-01-26 19:14
  • 更新:2021-01-26 20:42
  • 阅读:1661

小程序点击地图标记事件【bindlabeltap】问题

分类:uni-app

我要开发的功能是标记地图位置,点击位置跳转对应的页面,使用了小程序官方提供的bindlabeltap
但是运行起来是提示``` Do not have labeltap handler in component: pages/index/index,请问应该如何处理?感觉是uniapp的事件处理机制和原生小程序不同的问题吧?如果在原生小程序直接写Page({})里没问题.

代码如下:

<map id="map"
v-bind:subkey="mapKey"
v-bind:longitude="longitude"
v-bind:latitude="latitude"
v-bind:scale="scale"
v-bind:circles="circles"
v-bind:markers="markers"
layer-style="2"
show-scale="true"
enable-scroll="true"
show-location="true"
enable-poi="true"
enable-building="true"
bindmarkertap="markertap"
bindcallouttap="callouttap"
bindlabeltap="labeltap"></map>

在method中添加对应方法
```javascript  
labeltap(e) {  
                console.log(' labeltap', e)  
            },
2021-01-26 19:14 负责人:无 分享
已邀请:
magao

magao (作者)

自问自答下吧!
我本来时使用的原生地图组件,方法也是按照小程序官方的介绍来的,但是由于是使用的uniapp,总归是有些差异的,所以想到应该仔细阅读下uniap的官方文档,发现文档里的写法是这样的:

@labeltap="labeltap"

看到试了下,没有问题了

该问题目前已经被锁定, 无法添加新回复