如何在我的React项目中绘制Google地图?

huangapple go评论65阅读模式
英文:

How can I draw GooglMap in my React project?

问题

我不确定如何在React项目中展示Google地图,而不是使用CDN方式。我已经收到API密钥,但我无法做到。原因是什么?有时地图会出现然后很快消失。我感到困惑。

<GoogleMap
    mapContainerStyle={containerStyle}
    center={center}
    zoom={19}
    onLoad={onLoad}
    onUnmount={onUnmount}
    onGoogleApiLoaded={({map, maps}) => this.renderMarkers(map, maps)}
>
    <Marker position={center} title="这里"/>
</GoogleMap>
英文:

I am not sure how to show googlemap in react project not cdn way.
I already received API key, but I cannot .
What is the reason?
Sometimes map appeared and disappear soon.
I am confused.

&lt;GoogleMap
        mapContainerStyle={containerStyle}
        center={center}
        zoom={19}type here
onLoad={onLoad}
        onUnmount={onUnmount}
        onGoogleApiLoaded={({map, maps}) =&gt; this.renderMarkers(map, maps)}
      &gt;
      &lt;Marker position={center} title=&quot;HEre&quot;/&gt;
        
&lt;/GoogleMap&gt;

答案1

得分: -1

Oh, I can help you.
这很简单。
What is your hosting server name and domain.
Google API可以识别所有连接。
So When you registered in Google service, you have to implement correspondent domain.

英文:

Oh, I can help you.
This is very simple.
What is your hosting server name and domain.
Google API can identify all connections.
So When you registered in Google service, you have to implement correspondent domain.

huangapple
  • 本文由 发表于 2023年6月26日 15:18:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76554359.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定