You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React集成leaflet-radar报错:checkbox_div is not defined 求助

React + Leaflet 雷达控件添加报错问题

说明:使用React框架

我在Leaflet地图对象中配置雷达控件时遇到问题,地图可正常生成,但添加雷达时出现错误。

Google Chrome错误提示

问题出在以下代码片段:

import RadarMap from 'leaflet-radar'
.
.
.
drawMap(){
    let radar;

    this.map = L.map(this.id);// eslint-disable-line
    this.map.setView([this.latitude, this.longitude], this.zoom);

    L.tileLayer("https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png", { // eslint-disable-line
        accessToken: this.accessToken
      }
    ).addTo(this.map);

    radar = new L.Control.Radar({}); // eslint-disable-line
    radar.addTo(this.map);
  }

错误具体发生在调用以下代码行时:

radar.addTo(this.map);

若不调用该行,地图可正常生成,但添加该行后地图功能失效。我已为该问题耗时数小时,反复修改代码仍无法让雷达正常工作,恳请大家提供解决方案。


内容的提问来源于stack exchange,提问作者Suspicious Bird

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 13:15:21