我想用從反應 - 谷歌 - 地圖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「? 這基本上是你的問題。 –