首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >react-simple-map中的可选状态

react-simple-map中的可选状态
EN

Stack Overflow用户
提问于 2021-09-22 23:21:32
回答 1查看 86关注 0票数 0

我正在使用react-simple-maps库创建一个地图

到目前为止,这是我的代码

代码语言:javascript
复制
<ComposableMap
  style={{ backgroundColor: "white", }}
  projection="geoAlbers"
  fill={'rgb(185,185,185)'}
  projectionConfig={{
    center:[-5, 25]
  }}>
      <Geographies style={{backgroundColor:'green', bottom:100}} geography={geoUrl}>
        {({ geographies }) =>
          geographies.map(geo => (
            <Geography key={geo.rsmKey} geography={geo} />
          ))
        }
      </Geographies>
      <Marker coordinates={[-100.460846,25.649345]}>
      <g
        fill="none"
        stroke="#003DA5"
        strokeWidth="2"
        strokeLinecap="round"
        strokeLinejoin="round"
        transform="translate(-12, -24)"
      >
        <circle cx="12" cy="10" r="3" />
        <path d="M12 21.7C17.3 17 20 13 20 10a8 8 0 1 0-16 0c0 3 2.7 6.9 8 11.7z" />
      </g>
  </Marker>
  </ComposableMap>

但是,当您选择一个州时,有什么方法可以摆脱这个边界吗?

EN

回答 1

Stack Overflow用户

发布于 2021-09-23 03:25:41

可以通过在<Geography />上传递样式属性来做到这一点。

代码语言:javascript
复制
<ComposableMap>
      <Geographies geography={geoUrl}>
        {({ geographies }) =>
          geographies.map(geo => <Geography style={{
            default: { outline: "none" },
            hover: { outline: "none" },
            pressed: { outline: "none" },
          }} key={geo.rsmKey} geography={geo} />)
        }
      </Geographies>
    </ComposableMap>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69292276

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档