添加 WidgetsInTemplateMixin 后,我收到一个错误
dest.appendChild is not a function
在文档中,它声称如果 this.containerNode 不能包含任何子对象,则会出现错误。但是,我已经为带有 dojo 类型“dijit/layout/ContentPane”的 div 标记了 containerNode 连接点。谁能向我解释为什么这不起作用?
这是模板文件
<div class="${baseClass}">
<div class="${baseClass}Container"
data-dojo-type="dijit/layout/BorderContainer"
data-dojo-props="design: 'headline'">
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'top'">
Top
</div>
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'center'"
data-dojo-attach-point="containerNode">
</div>
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'leading', splitter: true">
Sidebar
</div>
</div>
</div>
这是javascript定义
define([
"dojo/_base/declare",
"dijit/_WidgetBase",
"dijit/_OnDijitClickMixin",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/layout/TabContainer",
"dijit/_TemplatedMixin",
"dijit/_WidgetsInTemplateMixin",
"dojo/text!./templates/MainContainer.html"
], function (declare,
_WidgetBase,
_OnDijitClickMixin,
BorderContainer,
ContentPane,
TabContainer,
_TemplatedMixin,
_WidgetsInTemplateMixin,
template)
{
return declare([_WidgetBase, _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin], {
templateString:template,
baseClass:"main"
});
});
以声明方式定义的自定义小部件
<div data-dojo-type="main/ui/MainContainer" data-dojo-props="title: 'Main Application'">
Hello Center!
</div>