我正在編寫使用ArcGIS API和Dojo類開發交互式地圖的代碼。Arcgis api模塊無法加載
它工作正常,直到我定義了一些模塊,如「esri/toolbars/draw」或一些其他模塊。這些給一個錯誤:HTTP://localhost/esri/toolbars/draw.js 404(未找到)
我的問題是,如果我使用許多其它模塊,例如「道場/ _base/DECLARE」, 'dojo/_base/lang','dojo/on','dojo/Deferred','esri/map'等等,爲什麼程序不能加載'esri/toolbars/draw'?有趣的是,它在localhost中搜索它,因爲我沒有在本地使用ArcGIS API,所以它不適合查看。
我想知道是否有人可以幫助我這個。以下是我的代碼示例:
require({
async: true,
parseOnLoad: true,
baseUrl: "/myApp/",
aliases: [
['text', 'dojo/text']
],
packages: [{
name: 'controllers',
location: 'js/controllers'
}, {
name: 'services',
location: 'js/services'
}, {
name: 'utils',
location: 'js/utils'
}, {
name: 'widgets',
location: 'js/widgets'
}, {
name: 'app',
location: 'js',
main:'main'
}]
}, ['app']);
___________________________________________ widgets/edit/drawTools.js
define([
'dojo/_base/declare',
'dojo/_base/lang',
'dojo/on',
'dijit/_WidgetBase',
'dijit/_TemplatedMixin',
'dojo/dom-class',
'text!widgets/edit/drawTools.html',
'esri/graphic',
"esri/toolbars/draw",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/PictureFillSymbol",
"esri/symbols/CartographicLineSymbol",
"esri/Color"
], function(
declare, lang, on, _WidgetBase, _TemplatedMixin, domClass, template, graphic, Draw, SimpleMarkerSymbol, SimpleLineSymbol,
PictureFillSymbol, CartographicLineSymbol, Color
) {
return declare([_WidgetBase, _TemplatedMixin], {
templateString: template,
map:null,
options:{},
constructor: function(options) {
this.options = options;
this.map = this.options.map;
},
postCreate: function() {
tb = new Draw(this.map);
tb.on("draw-end", '_addGraphic');
}
function _addGraphic(evt) {
}
})
})
非常感謝,它解決了這個問題。 – samira
很高興能幫到您,請將問題標記爲已回答。 –