我有一个简单的小部件:
define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom-construct"],
function(declare, WidgetBase, domConstruct){
return declare("gijit.workflow.debug.combi", [WidgetBase], {
startup: function(){
alert("started");
},
buildRendering: function(){
var container = domConstruct.create("div", {innerHTML:"test"}, this.domNode, "first");
var rad1 = domConstruct.create("input", {type:"radio"}, container, "first");
var rad1 = domConstruct.create("input", {type:"radio"}, container, "last");
}
});
});
和一个简单的加载页面:
<!DOCTYPE html>
<html >
<head>
<link rel="stylesheet" href="../../../css/tcs-style-dijit.css" />
<script>dojoConfig = {parseOnLoad: false}</script>
<script src="../../../js/dojo/dojo.js" data-dojo-config="async: true"></script>
<!-- <script src="../../../js/gijit/workflow/debug/combi.js"></script> -->
<script>
require(["dojo/dom", "gijit/workflow/debug/combi", "dojo/parser",
"dojo/_base/window"], function(dom, combi, parser, window) {
var widget = new combi();
widget.placeAt(window.body());
// widget.startup();
});
</script>
</head>
<body id="dd" class="tcs">
</body>
</html>
但是,我收到以下错误:
组件返回失败代码:0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLBodyElement.appendChild] domain">http:// domain : port /js/dojo/dojo.js Line 15
我已将错误隔离到尝试将小部件放置在 HTML 中的地步:
widget.placeAt(window.body());
我无法弄清楚是什么导致了这个问题,希望能得到一些帮助