We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36c2ca2 commit 044dc91Copy full SHA for 044dc91
components/markers/demo/which.md
@@ -1,6 +1,6 @@
1
---
2
title: 确定点击的是哪个坐标?
3
-order: 10
+order: 12
4
5
6
在使用 Markers 组件往地图上批量添加坐标点时,很常见的需求是:在事件触发时,比如点击事件,需要确定点击的是哪个坐标点。在提供原始数据来构造坐标点时(如下例中的 `this.markers`),我们可以在原始数据里注入自己的变量;当事件发生后,在回调里我们可以获得全部的原始数据,从而可以识别出点击的那个坐标点,及对应属性。
@@ -30,6 +30,7 @@ class App extends React.Component{
30
});
31
this.markersEvents = {
32
click(e, marker){
33
+ // 通过高德原生提供的 getExtData 方法获取原始数据
34
const extData = marker.getExtData();
35
const index = extData.myIndex;
36
alert(`点击的是第${index}号坐标点`);
0 commit comments