1.黑窗口安装
npm i react-bmapgl -S
2.引入js 在public/index.html
<script type="text/javascript" src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=你的ak"></script>
3. 引入组件
import {Map, Marker, NavigationControl, InfoWindow,Polyline,Polygon,ZoomControl } from 'react-bmapgl';
(根据自己的需要导入相应的组件)
Map
zoom="10"缩放层级
center={new BMapGL.Point(116.404449, 39.914889)} 中心点坐标
enableScrollWheelZoom={true}鼠标滚动缩放
heading 地图旋转角度
style={ { }}设置样式
Marker
icon="start"起点图标
icon="end"终点图标
onClick={}点击事件
Polygon
path= 路径
strokeColor="#f00" 线条颜色