我已经在https://tomchentw.github.io/react-google-maps/#groundoverlay这里基于React Google Maps lines = [['5.1', '3.5', '1.4', '0.2', 0],
['5.2', '2.5', '1.3', '0.1', 1]]
for line in lines:
for i in range(len(line)):
line[i] = float(line[i])
print(line)
print(lines)
示例(https://codesandbox.io/s/zkq1pv58zp)在Code Sandbox上创建了一个React项目。这是GroundOverlay
:
index.js
但是,当我单击“下载”按钮时,没有任何反应。类似的问题似乎在https://github.com/CompuIves/codesandbox-client/issues/658处描述,该问题与应用程序没有import React from "react";
import ReactDOM from "react-dom";
const { compose } = require("recompose");
const {
withScriptjs,
withGoogleMap,
GoogleMap,
GroundOverlay,
} = require("react-google-maps");
const MapWithGroundOverlay = compose(
withScriptjs,
withGoogleMap
)(props =>
<GoogleMap
defaultZoom={12}
defaultCenter={{lat: 40.740, lng: -74.18}}
>
<GroundOverlay
defaultUrl="https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg"
defaultBounds={new google.maps.LatLngBounds(
new google.maps.LatLng(40.712216, -74.22655),
new google.maps.LatLng(40.773941, -74.12544)
)}
defaultOpacity={.5}
/>
</GoogleMap>
);
import "./styles.css";
function App() {
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<h2>Start editing to see some magic happen!</h2>
<MapWithGroundOverlay
googleMapURL="https://maps.googleapis.com/maps/api/js?key=AIzaSyBimnrhiugaGSNN8WnsjpzMNJcrH_T60GI&v=3.exp&libraries=geometry,drawing,places"
loadingElement={<div style={{ height: `100%` }} />}
containerElement={<div style={{ height: `400px` }} />}
mapElement={<div style={{ height: `100%` }} />}
/>
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
目录有关,但是我是从React模板创建的项目,并且确实有src
目录。>
您知道为什么不下载该项目吗?
(顺便说一句,我正在尝试解决问题In React Google Maps, getting "'google' is not defined" even when component is wrapped with withScriptjs?,其中我的本地应用程序中出现了src
;某种程度上,代码沙箱中的应用程序正在运行,但是我没有了解为什么本地人不是这样。