首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >React JVectorMap标记

React JVectorMap标记
EN

Stack Overflow用户
提问于 2019-09-09 01:36:28
回答 1查看 439关注 0票数 0

这个问题指的是标记出现-我正在使用React

https://i.stack.imgur.com/hkqnZ.jpg

我的标记出现在正确的位置我毫不怀疑,但在0,0上有一些初始标记没有消失,我不知道如何删除它。只有当我从VectorMap组件中移除' markers‘属性时,它才会消失,但正如你所知道的,在那之后不会出现任何标记。

此外,我已经尝试了“透明”填充标记等,但它也会影响更正标记。

有没有什么设置可以删除这个one?我做错了什么吗?还是仅仅是库错误?

代码语言:javascript
复制
 <VectorMap
            map={"world_mill"}
            markers={{
              latLng: [this.state.CountryFetchLat, this.state.CountryFetchLon],
              name: this.state.CountryRegion
            }}
            backgroundColor="transparent"
            zoomOnScroll={true}
            zoomButtons={false}
            containerStyle={{
              width: "100%",
              height: "90%"
            }}
            containerClassName="map"
            markerStyle={{
              initial: {
                fill: "#4DAC26"
              }
            }}
            regionStyle={{
              initial: {
                fill: "#cccccc",
                "fill-opacity": 1,
                stroke: "none",
                "stroke-width": 0,
                "stroke-opacity": 0
              },
              hover: {
                "fill-opacity": 1,
                fill: "#99ff99",
                cursor: "pointer"
              },
              selected: {
                fill: "#ff0000"
              }
            }}
            selectedRegions={
              this.state.CountryRegion
                ? this.state.CountryRegion.toUpperCase()
                : null
            }
          />
EN

回答 1

Stack Overflow用户

发布于 2019-11-16 01:05:53

尝试以此格式排列标记:

代码语言:javascript
复制
markers={{
          US: { latLng: [38.9, -98.45], name: 'Name of City' }
        }}

这将使“幻影”标记消失。

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57844307

复制
相关文章

相似问题

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