Reactjs 在react中呈现Google地图时,Google未定义
目前我正在尝试在react中渲染简单贴图。我尝试过的一切,但都是血脉。现在我已经使用谷歌地图反应渲染谷歌地图,包括其库,但我仍然得到谷歌是未定义的,我不知道为什么。这是我的密码Reactjs 在react中呈现Google地图时,Google未定义,reactjs,google-maps-react,Reactjs,Google Maps React,目前我正在尝试在react中渲染简单贴图。我尝试过的一切,但都是血脉。现在我已经使用谷歌地图反应渲染谷歌地图,包括其库,但我仍然得到谷歌是未定义的,我不知道为什么。这是我的密码 // External Dependencies import React, { Component } from 'react'; import { withGoogleMap, GoogleMap , GoogleMapLoader,Marker} from 'react-google-maps'; // Inte
// External Dependencies
import React, { Component } from 'react';
import { withGoogleMap, GoogleMap , GoogleMapLoader,Marker} from 'react-google-maps';
// Internal Dependencies
import './style.css';
class HelloWorld extends Component {
static slug = 'nel_hello_world';
render() {
var google = window.google;
const GoogleMapExample = withGoogleMap(props => (
<GoogleMap
defaultCenter = { { lat: 40.756795, lng: -73.954298 } }
defaultZoom = { 13 }
>
</GoogleMap>
));
// const Content = this.props.content;
return (
<div>
<GoogleMapExample
containerElement={<div style={{ height: `500px`, width: '500px' }} /> }
mapElement={ <div style={{ height: `100%` }} /> }
/>
</div>
);
}
}
export default HelloWorld;
//外部依赖项
从“React”导入React,{Component};
从“react GoogleMaps”导入{withGoogleMap、GoogleMap、GoogleMapLoader、Marker};
//内部依赖关系
导入“/style.css”;
类HelloWorld扩展组件{
静态slug='nel_hello_world';
render(){
var google=window.google;
const GoogleMapExample=withGoogleMap(道具=>(
));
//const Content=this.props.Content;
返回(
);
}
}
导出默认HelloWorld;
有什么建议吗