我有dojoConfig如下:
plot.new_class
如何从另一个已加载的模块或小部件内部访问var base = location.href.split("/");
base.pop();
base = base.join("/");
var dojoConfig = {
async: true,
parseOnLoad: false,
isDebug: false,
packages: [{
name: "library",
location: base + '/js/lib'
}, {
name: 'widgets',
location: base + '/js/widgets'
}];
location
?
答案 0 :(得分:0)
所以从official site开始,dojo/require
会这样做。
以下是一个例子:
require(["dojo/_base/xhr", "dojo/dom"], function(xhr, dom){
// points to $dojoroot/dijit/form/tests/TestFile.html
var url = require.toUrl("dijit/form/tests/TestFile.html");
xhr.get({
url: url,
load: function(html){
dom.byId("foo").innerHTML = html;
}
});
});