Inheritance 扩展自定义dijit“;链式构造器“;错误
我在尝试扩展小部件时遇到一个问题,导致错误: 声明ImageBoxAnim:使用继承的 我没能找到有相同问题的人,所以我想这是因为我对Inheritance 扩展自定义dijit“;链式构造器“;错误,inheritance,dojo,Inheritance,Dojo,我在尝试扩展小部件时遇到一个问题,导致错误: 声明ImageBoxAnim:使用继承的 我没能找到有相同问题的人,所以我想这是因为我对dojo/\u base/declare缺乏理解 基类“_ImageBoxBase”(奇怪地简化): ImageBox(_ImageBoxBase的子类1): ImageBox动画(ImageBox的子类): 我已经尝试了许多declare语句的变体,唯一能让脚本不抛出错误的是一个空的“parent”类,但它不能widgitify。它将按原样呈现HTML/CSS,
dojo/\u base/declare
缺乏理解
基类“_ImageBoxBase”(奇怪地简化):
ImageBox(_ImageBoxBase的子类1):
ImageBox动画(ImageBox的子类):
我已经尝试了许多declare语句的变体,唯一能让脚本不抛出错误的是一个空的“parent”类,但它不能widgitify。它将按原样呈现HTML/CSS,但在返回的declare
对象中不调用任何方法
基本上,ImageBox
类中有一些功能,我希望imageboxaim
继承这些功能,同时添加更多功能(动画)
让我明白的是,在定义ImageBox类时,它的语法和扩展\u WidgetBase
的过程与扩展\u WidgetBase
的过程是相同的。很多在线示例都给出了扩展内置dijit的方法,所以我不知道哪里出了问题
注意:我知道这些在技术上不是“类”,但从扩展/子/超类的角度来看,更容易表达。我不能确定,但我想你会看到问题,因为构造函数是自动链接的(无需称之为.inherited)。如果您想手动连锁,请查看这也是我的想法。然而,即使在取出继承的调用,甚至更进一步,取出它仍然抛出的所有构造函数、后创建等调用时。我会尝试将一个提琴或测试页面放在tonite和post上。我不确定我做了什么,可能有些愚蠢,但我的其他Dijit正在按预期运行。我会再来看看。
define(['dojo/_base/declare', 'dijit/_WidgetBase'], function(declare, _WidgetBase){
return declare('_ImageBoxBase', [_WidgetBase], {
constructor : function(){...}
}
})
define(['dojo/_base/declare', './_ImageBoxBase'], function(declare, _ImageBoxBase){
return declare("ImageBox", [_ImageBoxBase], {
constructor : function(){
this.inherited(arguments)
// this class works like a charm
}
}
})
define(['dojo/_base/declare', './ImageBox'], function(declare, ImageBox){
return declare("ImageBoxAnim", [ImageBox], {
constructor : function(){
this.inherited(arguments)
// no worky!
}
}
})