huiyan-fe / react-bmap

基于百度地图JavaScript API封装的React组件库
http://huiyan-fe.github.io/react-bmap
MIT License
497 stars 97 forks source link

CustomOverlay Markers does not support Events / BMap.Marker is not added if there is a CustomOverlay #8

Closed williamli closed 7 years ago

williamli commented 7 years ago

If Marker contains children, BMap.Marker is not created andbindEvent is not called.

https://github.com/huiyan-fe/react-bmap/blob/1d4a00565b98da9378e0c54e6a6281313061fca2/src/components/marker.js#L163-L173

hinikai commented 7 years ago

Thank you for your feedback. The problem has been solved in version 1.0.39 at npm. you can update it and see this example to use.

<Marker position={{lng: 109.430831, lat: 38.211366}} offset={new BMap.Size(-75, -60)}> <div onClick={function(){alert(1)}} style={{width: '150px', height: '40px', lineHeight: '40px', background: 'red', textAlign: 'center'}}>自定义覆盖物

williamli commented 7 years ago

works great .