我正在尝试让mapbox在一个小项目中工作。 https://www.npmjs.com/package/react-mapboxmap
import React from 'react';
import MapboxMap from 'react-mapbox';
class Operator extends React.Component {
render() {
return (
<div className='container'>
<MapboxMap
mapId="mapbox.comic"
zoomControl={false}
center={[59.907433, 30.299848]} zoom={17}
/>
</div>
);
}
}
export default Operator;
就像他们在npm包的描述页面上说的那样。但是,我得到的只是这个错误消息:
ReferenceError: L is not defined
有什么想法吗?
答案 0 :(得分:1)
尝试添加
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
Notice: this never was a full-feature library, merely a layer on top of Mapbox JS SDK. For a better, more full fledged solution, try react-leaflet (in conjunction with the Mapbox Maps API in our case).
答案 1 :(得分:0)
这就是你想要做的 - &gt;
从传单&#39 ;;
导入L.