安卓小程序 Map 组件 bindtap 无效
发布于 5 年前 作者 pingfu 6592 次浏览 来自 问答

微信版本:6.5.16.1120

基础库版本:1.6.3(2017.10.20 15:03:22)

安卓小程序 Map 组件绑定点击事件无效,iPhone 没问题

8 回复

微信版本:6.5.16,基础库版本 1.6.0

试了一下,是地图有 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)
  }
})

好的,麻烦看一下我的另一个问题呢【小程序 cover-view 设置 align-items 无效

你好,请问map 组件的bindtap事件,正常了吗?

点Marker有没有响应bindmarkertap事件?

回到顶部