簡體   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