Google React Maps-如何更改控件颜色?

时间:2018-06-22 07:56:46

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

我将google-react-mapszoomControlmapTypeControl一起使用:

enter image description here

  <Map onMount={(map, maps) => {}} {...mapProps} style={{
      height: '100%'
    }} api-key={key} optionsConstructor={(maps) => {
      return {
        disableDefaultUI: true,
        keyboardShortcuts: true,
        mapTypeId: maps.MapTypeId.HYBRID,
        mapTypeControl: true,
        mapTypeControlOptions: {
          style: maps.MapTypeControlStyle.DROPDOWN_MENU,
          position: maps.ControlPosition.TOP_RIGHT
        },
        scaleControl: true,
        rotateControl: true,
        rotateControlOptions: {
          position: maps.ControlPosition.RIGHT_TOP
        },
        zoomControl: true,
        zoomControlOptions: {
          position: maps.ControlPosition.RIGHT_TOP             
        }
      }
    }}>

如何更改缩放和地图类型控件的背景颜色?

1 个答案:

答案 0 :(得分:1)

只需将元素作为目标,然后添加CSS背景颜色(div> div> div>按钮)。通过使用css中的类而不是元素,可以更加具体。这是我所做的(检查CSS代码):

DateUpdated
`DateAdded` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`DateUpdated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
 Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

这是一个工作示例:http://jsbin.com/cosezum/edit?html,css,js,output

希望这对您有帮助!