0

当我为生产编译代码并部署到服务器但没有在本地获取它时,我收到此错误消息。我很困惑为什么我不能在本地重新生产

Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
    at E (tabbed-dataview.js:2526)
    at M.getTileUrl (tabbed-dataview.js:2749)
    at M.createTile (tabbed-dataview.js:2748)
    at M._addTile (tabbed-dataview.js:2744)
    at M._update (tabbed-dataview.js:2741)
    at M._setView (tabbed-dataview.js:2737)
    at M._resetView (tabbed-dataview.js:2736)
    at M.onAdd (tabbed-dataview.js:2727)
    at M._layerAdd (tabbed-dataview.js:2655)
    at M.whenReady (tabbed-dataview.js:2615)

这是代码的样子


(defn map-component
  [selected-tileset]
  (let [all-geofields @(re-frame/subscribe [::subs/geofields])
        selected-geofield @(re-frame/subscribe
                             [::subs/selected-geofield-or-all])
        all-selected? (= :all (:name selected-geofield))
        geojson @(re-frame/subscribe [::subs/geojson])
        leaflet-map (useMap)]
    (js/console.log "x" (clj->js geojson))
    (js/console.log "y" (clj->js leaflet-map))
    (when (seq (:features geojson))
      (let [geo-json (geoJson (clj->js geojson))]
        (js/console.log "z" (clj->js leaflet-map))
        (try (.fitBounds leaflet-map (.getBounds geo-json))
             (catch js/Error e (js/console.log e))))
      [:<> [field-toggle] [layer-chooser] [:> TileLayer selected-tileset]
       [:> ZoomControl {:position "bottomleft"}]
       (if all-selected?
         (map (fn [geofield] [feature-group geofield]) all-geofields)
         [feature-group selected-geofield])])))

(defn map-page
  []
  (let [selected-tileset @(re-frame/subscribe
                            [::subs/selected-tileset-or-default])
        geojson @(re-frame/subscribe [::subs/geojson])]
    (if geojson
      [:div.map-page.tab-page {:key (:url selected-tileset)}
       [:> MapContainer {:zoomControl false}
        [:f> map-component selected-tileset]]]
      [loading-spinner-component])))

4

1 回答 1

0

似乎selected-tileset为零,这就是导致此错误的原因...getTileUrl应该是一个线索(不知道为什么我看不到它)

于 2021-10-28T10:06:40.837 回答