Open alivelee opened 8 years ago
What's the BMap
?
this this._map = new BMap.Map(this.id);
BMap in your component
I mean how do you require the BMap
? I didn't use any keyword names "BMap"...
I haven't required BMap . I think it's coming from the script that from the Baidu Map API. You use the BMap in your componentDidMount lifecycle I add the script file in index file but can't require BMap from the script
It's a bug in source code, need to change new BMap
to new window.BMap
.
@gengjiawen I will try later
Bmap may need add ur index.html header
<head>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=NrTYvuK4VE8l4E7e7eTEtcOe"></script>
</head>
//NrTYvuK4VE8l4E7e7eTEtcOe is my ak, u need use ur ak
I wraped my components like this
and i use create-react-app as a boilerplate,it can not compiled