gpt4 book ai didi

javascript - 道场: Cannot read property 'h' of undefined on AccordionContainer. js?

转载 作者:行者123 更新时间:2023-11-29 10:50:12 25 4
gpt4 key购买 nike

当我在 Accordion 容器下动态创建两个 Accordion 容器时,出现这样的错误。

当我创建这些单个 Accordion 容器中的任何一个而不是一起创建时,不会发生错误。

Error :

Cannot read property 'h' of undefined on AccordionContainer.js

我已经通过将这些行添加到工具包文件来临时解决了这个问题,dojo-toolkit\dijit\layout\AccordionContainer.js

Line 91: + if(this._contentBox) 
Line 92: this._verticalSpace=_34.h-_35-_2f.h-_30.h-_32.h-_33.h-_2d._buttonWidget.getTitleHeight();
Line 93: + if(this._contentBox)
Line 94: this._containerContentBox={h:this._verticalSpace,w:this._contentBox.w-_2f.w-_30.w-_32.w- _33.w};

Accordion Widget 创建代码结构为

define("test/project", [ 
"dojo/_base/declare",
"dijit/_Widget",
"dijit/layout/AccordionContainer"],
function(declare, _Widget, AccordionContainer) {
return declare([_Widget],{
postCreate: function() {
var new_acc = new AccordionContainer({
id: "new_acc",
title: "Approval ("+this.count+")"
});

this.parentId.addChild(new_acc);
}
});
});

有解决这个问题的想法吗?

提前致谢...

最佳答案

我遇到了同样的问题,但我想通了。当您尝试在 aContainer.startup() 之后用 Accordion 创建另一个 child 时;方法,它将生成相同的错误消息。启动方法启动 Accordion ,它将动态地将高度和宽度应用于该 Accordion ,如果您在创建 Accordion 后再次为其创建子级,它将抛出错误“无法读取 AccordionContainer.js 上未定义的属性‘h’”

      aContainer = new AccordionContainer({ style: "height: 300px" },acdic);
aContainer.addChild(new ContentPane({
title: "This is a content pane",
content: "Hi!"
}));

aContainer.addChild(new ContentPane({
title: "This is as well",
content: "Hi how are you?",
id: "pane1"
}));
aContainer.startup();
aContainer.addChild(new ContentPane({
title: "This too",
content: "Hello im fine.. thnx"
}));

关于javascript - 道场: Cannot read property 'h' of undefined on AccordionContainer. js?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11686153/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com