我試圖擴展插件時的問題,給我的錯誤:擴展自定義的dijit「鏈構造」錯誤
declare ImageBoxAnim: calling chained constructor with inherited
我是在用同樣的問題找到任何不成功的,所以我想這是我的當涉及到dojo/_base/declare
時缺乏理解。
基類 「_ImageBoxBase」(奇形怪狀簡化):
define(['dojo/_base/declare', 'dijit/_WidgetBase'], function(declare, _WidgetBase){
return declare('_ImageBoxBase', [_WidgetBase], {
constructor : function(){...}
}
})
ImageBox(_ImageBoxBase的子類1):
define(['dojo/_base/declare', './_ImageBoxBase'], function(declare, _ImageBoxBase){
return declare("ImageBox", [_ImageBoxBase], {
constructor : function(){
this.inherited(arguments)
// this class works like a charm
}
}
})
ImageBoxAnim(ImageBox的子類):
define(['dojo/_base/declare', './ImageBox'], function(declare, ImageBox){
return declare("ImageBoxAnim", [ImageBox], {
constructor : function(){
this.inherited(arguments)
// no worky!
}
}
})
我已經嘗試了很多與declare語句的變體,並且至少會允許的唯一的變體不拋出錯誤的腳本是一個空的「父」類,但是它不支持widgitify。它將呈現HTML/CSS,但在返回的declare
對象中調用NO方法。
本質上有ImageBox
類中的功能我希望ImageBoxAnim
繼承,同時添加更多的功能(動畫)。
得到我的東西是在定義ImageBox類時,它的語法和我想的是相同的過程來擴展_WidgetBase
,因爲它擴展了一些擴展了_WidgetBase
的東西。很多在線示例都提供了擴展內置的dijits的方法,所以我不知道我哪裏會出錯。
注意:我知道這些在技術上不是「類」,但從擴展/子類/超類的角度來看,它更容易表達。
這就是我曾經想過的。然而,即使拿出繼承的調用,甚至進一步取出所有的構造函數,postCreate等調用它仍然拋出。我會盡力把小提琴或測試頁放在一起。 – Phix
我不確定我做了什麼,可能有點愚蠢,但我的其他dijits按預期運行。我會重溫。 – Phix