我需要在Google地图上只打开一个InfoWindow.在打开新的InfoWindows之前,我需要关闭所有其他InfoWindows.
有人能告诉我怎么做吗?
我正在尝试在Airbnb上构建类似的地图,您可以在拖动地图时查看地点标记.我想在地图上显示Google Places API中的"酒店"标记.
使用谷歌地图中的以下JS代码我可以在谷歌地图上显示酒店,但我想使用反应谷歌地图使用React .
<!DOCTYPE html>
<html>
<head>
<title>Place searches</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script>
// This example requires the Places library. …
Run Code Online (Sandbox Code Playgroud) javascript google-maps-api-3 google-places-api reactjs react-google-maps