我有以下代码:
require(["dijit/registry", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/form/Button", "dojo/query", "dojo/domReady!"], function(registry, BorderContainer, ContentPane, Button, query){
var appLayout = new BorderContainer({
design: "sidebar"
}, "appLayout");
var dataArea = new ContentPane({
region: "center",
content: '<div id="grid"></div>'
});
var actionArea = new ContentPane({
region: "bottom",
id: "actionarea",
content: '<button id="computer"></button>'
});
var treeArea = new ContentPane({
region: "left",
id : "treearea",
content: '<div id="treeroot"></div>',
splitter: true
});
var button = new Button({
label: "Load Computer tree"
}, "computer");
appLayout.addChild(treeArea);
appLayout.addChild(dataArea);
appLayout.addChild(actionArea);
appLayout.startup();
button.startup();
});
所有布局均已正确加载,但我的按钮未加载。
我试图在 button.startup() 调用之前查询#computer,它加载得很好。
appLayout.addChild(treeArea);
appLayout.addChild(dataArea);
appLayout.addChild(actionArea);
appLayout.startup();
console.log(query("#computer"));
button.startup();
});
预先感谢您的任何帮助