繁体   English   中英

反应 JVectorMap 标记

[英]React JVectorMap marker

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

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

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

此外,我尝试过“透明地”填充标记等,但它也会影响正确的标记。

是否有一些设置可以删除这个被窃听的程序? 我做错了什么还是只是库错误?

 <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
            }
          />

尝试以这种格式排列标记:

markers={{
          US: { latLng: [38.9, -98.45], name: 'Name of City' }
        }}

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

希望这可以帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM