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

点击地图点位弹窗无法弹出,控制台报错:d.ActionsCollection is not a constructor

问题:点击地图点位弹窗无法弹出,控制台报ActionsCollection构造函数错误

点击地图上的点位时,弹窗无法正常弹出,控制台输出错误信息:

Popup.js:6 Uncaught (in promise) TypeError: d.ActionsCollection is not a constructor

相关代码

require(["esri/WebMap", "esri/views/MapView", "esri/widgets/Search", "esri/widgets/Zoom", "esri/widgets/Locate", "esri/popup/content/ImageMediaInfo", "esri/config", "esri/portal/Portal"], function (WebMap, MapView, Search, Zoom, Locate, ImageMediaInfo, esriConfig, Portal) {
    esriConfig.portalUrl = "https://test.org/portal";

    webmap = new WebMap({
        portalItem: {
            id: "*********",
        },
    });

   
    var view = new MapView({
        map: webmap,
        container: "viewDiv",
        center: [-95.9406, 41.26],
        zoom: 13,
        
        basemap: "topo",
        constraints: {
            minZoom: 12,
           
        },
    });
    // webmap.loadStatus
    view.when(function () {
        webmap
            .load()
            .then(function () {
                
                return webmap.basemap.load();
            })
            .then(function () {
                
                let allLayers = webmap.allLayers;
                

                var promises = allLayers.map(function (layer) {
                    return layer.load();
                });
                return Promise.all(promises.toArray());
            })
            .then(function (layers) {
                webmap.removeAll();

                

                
            })
            .catch(function (error) {
                // the webmap or portal failed to load
                console.log("The resource failed to load: ", error);
            });
    });
});

解决方案

  • 补充缺失的模块依赖:错误提示ActionsCollection未定义,说明代码未加载对应的ArcGIS模块。如果WebMap配置了弹窗操作,需在require的依赖列表中添加esri/popup/actions/ActionCollection(旧版API)或esri/core/Collection(新版API),并在回调函数中引入对应的构造函数。
  • 移除图层删除逻辑:代码中webmap.removeAll()会清空WebMap内所有图层,导致没有可触发弹窗的点位图层。若这不是预期操作,直接删除该行代码。
  • 核对API版本兼容性:ArcGIS JS API 4.x部分新版本已弃用ActionsCollection,改用Collection管理弹窗操作。需确认API版本与WebMap的弹窗配置匹配,若版本不兼容,需调整模块引用或更新WebMap配置。

内容的提问来源于stack exchange,提问作者Adam-KER

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 17:03:16