Skip to content

Commit 044dc91

Browse files
committed
update: doc content
1 parent 36c2ca2 commit 044dc91

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/markers/demo/which.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 确定点击的是哪个坐标?
3-
order: 10
3+
order: 12
44
---
55

66
在使用 Markers 组件往地图上批量添加坐标点时,很常见的需求是:在事件触发时,比如点击事件,需要确定点击的是哪个坐标点。在提供原始数据来构造坐标点时(如下例中的 `this.markers`),我们可以在原始数据里注入自己的变量;当事件发生后,在回调里我们可以获得全部的原始数据,从而可以识别出点击的那个坐标点,及对应属性。
@@ -30,6 +30,7 @@ class App extends React.Component{
3030
});
3131
this.markersEvents = {
3232
click(e, marker){
33+
// 通过高德原生提供的 getExtData 方法获取原始数据
3334
const extData = marker.getExtData();
3435
const index = extData.myIndex;
3536
alert(`点击的是第${index}号坐标点`);

0 commit comments

Comments
 (0)