2020-03-09 01:04:27 +08:00
|
|
|
|
---
|
|
|
|
|
title: Marker 组件
|
|
|
|
|
order: 3
|
|
|
|
|
---
|
2020-11-17 10:59:32 +08:00
|
|
|
|
|
2020-11-16 15:19:41 +08:00
|
|
|
|
`markdown:docs/common/style.md`
|
2020-11-17 10:59:32 +08:00
|
|
|
|
|
2020-03-09 01:04:27 +08:00
|
|
|
|
## Marker Props
|
|
|
|
|
|
|
|
|
|
| prop name | Type | Default | Description |
|
|
|
|
|
| -------------- | ----------------- | ------- | ----------------- |
|
|
|
|
|
| option | `string` | `null` | marker 配置项 |
|
|
|
|
|
| lnglat | `Array | Object` | `null` | marker 经纬度位置 |
|
|
|
|
|
| onMarkerLoaded | `Function` | `null` | layer 回调函数 |
|
|
|
|
|
| children | `React.ReactNode` | `null` | 子组件 |
|
|
|
|
|
|
|
|
|
|
### option
|
|
|
|
|
|
|
|
|
|
| prop name | Type | Default | Description |
|
|
|
|
|
| --------- | ------------ | ------- | ------------------------------------------------------------------------------ |
|
|
|
|
|
| color | `string` | `blue` | marker 配置项 |
|
|
|
|
|
| anchor | `string` | `null` | center, top, top-left, top-right, bottom, bottom-left,bottom-right,left, right |
|
|
|
|
|
| offsets | `Array[x,y]` | `null` | marker 位置偏移 |
|
|
|
|
|
| extData | `object` | `null` | marker 属性数据 |
|
|
|
|
|
|
2020-03-11 21:35:11 +08:00
|
|
|
|
## Maker 事件
|
|
|
|
|
|
|
|
|
|
通过 onMarkerLoaded 方法获取 Marker 实例监听
|
|
|
|
|
|
2020-03-09 01:04:27 +08:00
|
|
|
|
## 实例
|
|
|
|
|
|
|
|
|
|
```jsx
|
2020-11-27 16:22:44 +08:00
|
|
|
|
import { Marker } from '@antv/l7-react';
|
|
|
|
|
<Marker lnglat={[120, 32]} />;
|
2020-03-09 01:04:27 +08:00
|
|
|
|
```
|