簡體   English   中英

如何使用給定的圖像文件設置React google map標記的樣式

[英]How to style the React google map marker using the given image file

現在我正在使用React-google-map組件,並希望將標記更改為我自己的圖像。 目前,我無法使用CSS更改標記的大小。 我嘗試如下:

var image = {
    url: '../images/icons/yellow.png',
    size: 10
};

return (
    <Marker 
        position={location}
        icon={image}
        onClick={this.handleMarkerClick.bind(this, marker)}
    />
    );

如果您知道解決方案,請告訴我。

感謝您的幫助。

您必須傳遞圖片的網址,例如:icon = {url}

例:

```
return (
    <Marker 
    position={location}
    icon={"http://maps.google.com/mapfiles/ms/icons/blue.png"}
    />
);

For more info: [github.com/tomchentw/react-google-maps/issues/486][1]


  [1]: http://github.com/tomchentw/react-google-maps/issues/486

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM