<分区>
我目前正在使用 react-google-map
让 Google 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
DOC 所说的一样,这里没什么特别的!
昨天我刚开始构建 map ,和往常一样,我去我的谷歌控制台拿到了一个 key ,然后我把它放在链接的 MY_KEY_HERE
部分,直到今天早上它都运行良好,今天我正在努力:
You have exceeded your request quota for this API
不是:
You have exceeded your daily request quota for this API
如下:
我搜索了 Google,我找到了 this和 this和 this和许多其他人,但我找不到这个问题的任何正确答案。
我尝试了什么?
- 我在我的控制台中创建了几个其他的键来解决这个问题,但没有解决,我得到了同样的
你已经超过了你的这个 API 的请求配额
错误 - 我在 Google 上使用了我的另一个帐户来解决这个问题,我刚刚登录并转到控制台平台并再次生成了一个 key ,但我仍然收到该错误消息?
- 即使在 codeSandBox.io 中尝试,我仍然遇到同样的错误
我真的很困惑这个问题,我该如何解决?