我想用从反应 - 谷歌 - 地图HeatmapLayer
,但我得到了错误的打击:反应 - 谷歌 - 地图HeatmapLayer未定义
Uncaught (in promise) TypeError: Cannot read property 'HeatmapLayer' of undefined
我一直triying做这件事情的作品,但我不能打头上的钉子,也期待在这个环节上没有什么有用的 (https://github.com/tomchentw/react-google-maps/issues/409)
import {withGoogleMap,GoogleMap} from "react-google-maps"
import HeatmapLayer from "react-google-maps/lib/visualization/HeatmapLayer"
render(){
var data = [new window.google.maps.LatLng(37.782551, -122.445368),
new window.google.maps.LatLng(37.782745, -122.444586),
new window.google.maps.LatLng(37.782842, -122.443688),
new window.google.maps.LatLng(37.782919, -122.442815),
new window.google.maps.LatLng(37.782992, -122.442112),
new window.google.maps.LatLng(37.783100, -122.441461)
]
const Heatmap = withGoogleMap(props => (
<GoogleMap
defaultZoom={1}
center={{lat: 19.435031,lng: -99.167357}}
>
<HeatmapLayer data = {data} />
</GoogleMap>));
return(
<div className="googleMap">
<Heatmap
containerElement={
<div style={{ height: `100%` }} />
}
mapElement={
<div style={{ height: `100%` }} />
}
center={{ lat: -25.363882, lng: 131.044922 }}
/>
</div>)
}
}
这只是一个错误改变**未捕获的(以诺)错误:你有“库=可视化“吗?** –
我正在使用版本8.0.0 –
未捕获(承诺)错误:您是否在URL中包含”libraries = visualization“? 这基本上是你的问题。 –