[英]Is there any way to put a image inside a marker on the google maps?
您可以在Marker組件中傳遞Options props,並將您的圖像src url放在icon屬性中。 (未經測試,但我認為它適合您)
例
<GoogleMap
defaultZoom={8}
defaultCenter={{ lat: -34.397, lng: 150.644 }}
>
<Marker
options={{ icon: { url: ...., scaledSize: ...., size: .... } }}
position={{ lat: -34.397, lng: 150.644 }}
/>
</GoogleMap>
scaledSize:縮放后整個圖像的大小(如果有)。 使用此屬性可拉伸/縮小圖像或精靈。
size:精靈或圖像的顯示大小。 使用精靈時,必須指定精靈大小。 如果未提供尺寸,則將在圖像加載時設置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.