在map.vue中,地图初始化后,给地图增加一个标记点;
<view :city="city" :change:city="mapObj.updateCity" :prop="mapConfig" :change:prop="mapObj.updateMapConfig" polyline="polyline" :change:polyline="mapObj.updatePolyline" :markers="markers" change:markers="mapObj.updateMarkers" :vehicles="vehicles" :change:vehicles="mapObj.updateVehicles" statusChangeData="statusChangeData" :change:statusChangeData="mapObj.updateStatusChangeData" :gpsData="gpsData" change:gpsData="mapObj.updateGpsData" :mapLayerConfig="mapLayerConfig" change:mapLayerConfig="mapObj.mapLayerConfigChange" id="containerMap"></view>let marker = new AMap.Marker({
position: new AMap.LngLat(Number(veh.longitude), Number(veh.latitude)),
zooms: [2, 20], //标注显示级别范围
zIndex: 1000,
anchor: "center",
icon: new AMap.Icon({
size: new AMap.Size(47, 30),
imageSize: new AMap.Size(47, 30),
image: getStatusIcon(veh),
}),
angle: getAngle(veh.angle),
label: {
offset: new AMap.Pixel(-41, 0),
content: <div class='vehicle-info'>${getVehicleName(veh)}</div>
,
// center: "center"
},
});
marker.on("touchstart", function (e: any) {
console.log('touchstart111111111111111111')
});
dataMap.map.add(marker);
touchstart事件在ios不起作用。安卓是可以的。 怎么解决?
5***@qq.com (作者)
没有用到<map>组件。用的<view>,然后通过高德的webAPI创建了地图,在地图上使用new AMap.Marker打了一个图标,想触发点击事件
2024-08-19 14:35
DCloud_UNI_yuhe
回复 5***@qq.com: 那似乎你得查阅查阅高德文档解决了,你尝试去高德反馈个工单看看他们怎么说
2024-08-19 14:40