【发布时间】:2021-10-20 17:42:18
【问题描述】:
注意:我正在使用“react-google-maps”api,这就是我当前 InfoWindow 的设置方式
{showingInfoWindow && selectedPlace === spot._id && <InfoWindow
className="info-window"
onCloseClick={onInfoWindowClose}
position={{lat: spot.lat, lng: spot.lng}}
>
<div className="iw-container">
<strong className="iw-title">{spot.name}</strong>
<div className="iw-content">
<a href={'https://maps.google.com/?ll=' + spot.lat + ',' + spot.lng} target= "_blank" className="iw-subTitle">{spot.location}</a>
<div>Added By: {currentUser.displayName === spot.user ? "Me" : spot.user}</div>
<div>{spot.type}</div>
<div>{spot.desc}</div>
<div>{moment(spot.createdAt).format("MMM Do YYYY")}</div>
{/* <img src={`/server/uploads/${spot.createdAt.split('.')[0]+"Z"}.jpg`}> </img> */}
</div>
</div>
</InfoWindow>}
我想知道如何将图像添加到信息窗口,我已经看到它使用其他 api 中的内容道具完成,并且 react-google-maps 文档有一个用于更新内容的道具,但我找不到如何在他们的文档上设置内容。任何帮助表示赞赏!
【问题讨论】:
标签: image google-maps infowindow react-google-maps