【问题标题】:How to change marker label color of react-google-maps如何更改 react-google-maps 的标记标签颜色
【发布时间】:2021-07-10 06:33:11
【问题描述】:

我正在使用@react-google-maps/api 库。我已经集成了谷歌地图,但我面临标记标签颜色,我非常努力但没有找到任何解决方案。有人可以帮我解决这个问题。

import {
  Marker,
} from "@react-google-maps/api";

{markers.map(({ id, name, position }) => (
        <Marker
          key={id}
          position={position}
          onClick={() => handleActiveMarker(id)}
          label={`${id}`}
        >
          {activeMarker === id ? (
            <InfoWindow onCloseClick={() => setActiveMarker(null)}>
              <div>{name}</div>
            </InfoWindow>
          ) : null}
        </Marker>
      ))}

【问题讨论】:

标签: javascript reactjs google-maps google-maps-api-3 react-google-maps


【解决方案1】:

试试这个: label: {text: `${id}`, color: "blue"}

【讨论】:

    猜你喜欢
    • 2021-09-22
    • 2020-05-03
    • 2013-05-02
    • 2018-11-25
    • 1970-01-01
    • 2013-04-18
    • 2011-01-29
    • 2021-07-21
    • 2015-12-10
    相关资源
    最近更新 更多