简体   繁体   English

关于使用dojo加载所需的库的问题

[英]Issue on Loading Required Library With dojo

I have dojo js file and I have saved the ClusterLayer.js in all directories like 我有dojo js文件,并且已经将ClusterLayer.js保存在所有目录中,例如

root --> ClusterLayer.js
root --> extras/ClusterLayer.js
root -->js/extras/ClusterLayer.js
root -->js/ClusterLayer.js

and the file is like 和文件就像

    require([
    "esri/map",
    "dojo/_base/array",
    "esri/layers/ArcGISDynamicMapServiceLayer",
    "esri/geometry/Geometry",
    "esri/geometry/Point",
    "esri/geometry/webMercatorUtils",
    "extras/ClusterLayer",
    "esri/graphic",
    "esri/symbols/SimpleMarkerSymbol",
    "esri/symbols/SimpleLineSymbol",
    "esri/symbols/SimpleFillSymbol",
    "esri/Color",
    "esri/InfoTemplate",
    "esri/dijit/HomeButton",
    "esri/dijit/OverviewMap",
    "dojo/parser",
    "esri/layers/GraphicsLayer",
    "esri/SpatialReference",
    "esri/dijit/PopupTemplate",

    "dijit/layout/BorderContainer", 
    "dijit/layout/ContentPane",
    "dojo/domReady!"
    ], function(Map, arrayUtils, ArcGISDynamicMapServiceLayer, Geometry, Point, webMercatorUtils, ClusterLayer, Graphic, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol, Color, InfoTemplate, HomeButton, OverviewMap,   parser, GraphicsLayer, SpatialReference, PopupTemplate)

but still getting error 但仍然出现错误

在此处输入图片说明

Can you please let me know why this is happening? 您能告诉我为什么会这样吗?

There is an ArcGIS tutorial that discusses doing exactly this . 有一个ArcGIS教程讨论了如何做到这一点 (Jump to step 4; apparently the link fragment doesn't navigate within the page correctly.) (跳至第4步;显然,链接片段未在页面中正确导航。)

I would note, though, that generally setting packages is preferable over paths , so instead of setting this: 不过,我要指出的是,通常设置packagespaths更可取,因此与其设置它:

paths: { extras: location.pathname.replace(/\/[^/]+$/, "") + "/extras" }

I would set this: 我将其设置为:

packages: [
    { name: "extras", location: location.pathname.replace(/\/[^/]+$/, "") + "/extras" }
]

(See also Dojo's CDN tutorial which explains basically the same situation.) (另请参见Dojo的CDN教程 ,该教程说明了基本相同的情况。)

Both should roughly have the same effect in this case. 在这种情况下,两者应大致具有相同的效果。

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

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