Closed williamli closed 7 years ago
BMap is from Baidu map SDK, you should import Baidu SDK first.
@zmofei which npm modules is the Baidu map SDK in?
you can get Baidu map SDK from http://lbsyun.baidu.com/, then you can import the SDK from the URL http://api.map.baidu.com/api?v=2.0&ak=YOUR_SDK
.
eg:
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=YOUR_SDK"></script>
<script>
// ... your code
</script>
I have that on the browser side. I am using Meteor + React and the server is crashing because BMap is not defined there. Let me see if Baidu map SDK has a npm package.
Problem solved. I had to stop importing react-bmap at run time to prevent the server from picking it up.
It can then be loaded in the browser once Baidu SDK is loaded in the browser the functions using require
or dynamic import
.'
@williamli I have the same problem. How do you solve it
@williamli I already install vue-baidu-map,but still have this problem;
when
import {Map, Marker, NavigationControl, InfoWindow} from 'react-bmap';
I get
BMap is not defined