我目前使用react-google-map
让谷歌 map 在我的React项目中运行,以下是我的 map 组件:
import React from 'react'
import { compose, withProps, lifecycle } from 'recompose'
import { withScriptjs, withGoogleMap, GoogleMap } from 'react-google-maps'
import MapStyle from '../../../api/mapStyle'
const Map = ({ children }) => {
return (
<GoogleMap
defaultZoom={15}
defaultCenter={{ lat: 35.6840299, lng: 51.3861187 }}
>
{children}
</GoogleMap>
)
}
export default compose(
withProps({
googleMapURL: "https://maps.googleapis.com/maps/api/js?key=MY_KEY_HERE",
loadingElement: <div style={{ height: `100%` }} />,
containerElement: <div className='map' style={{ height: `100vh` }} />,
mapElement: <div style={{ height: `100%` }} />
}),
withScriptjs,
withGoogleMap,
)(Map)
正如你所看到的,这是react-google-map
博士所说的,这里没有什么特别的!
昨天我刚开始构建 map ,像往常一样,我go 我的谷歌控制台获取了一个密钥,然后我把它放在链接的MY_KEY_HERE
部分,它工作得很好,直到今天早上,今天我还在努力:
您已超过此API的请求配额
不是:
您已超过此API的每日请求配额
详情如下:
我搜索了谷歌,找到了this、this、this以及其他很多东西,但我找不到这个问题的正确答案.
我试了什么?
- I created a couple of other keys in my console to remove this problem , but it is not solved, I got the same
您已超过此API的请求配额
error - 我在谷歌上使用了我的另一个帐户来解决这个问题,我刚刚登录到控制台平台,再次生成了一个密钥,但我仍然收到了那个错误吗?
- 即使是在codeSandBox中try .伊奥,我还是犯了同样的错误
我真的很困惑这个问题,我该怎么解决?