我在Dojo尝试
var a=new DATALINK_MSTP();
但我收到错误 基类不是可调用的构造函数
dojo.declare("DATALINK", null, {
_id:'',
_type:'',
_network:'',
_mac:'',
_hop_count:'',
_mqueue:'',
constructor: function(){
this._id='';
this._type='';
this._newtwork='';
this._mac='';
this._hop_count='';
this._mqueue=new MQUEUE();
},
get_id:function(){
return this._id;
},
set_id:function(id){
this._id=id;
},
get_type:function(){
return this._type;
},
set_type:function(type){
this._type=type;
},
get_network:function(){
return this._network;
},
set_network:function(network){
this._network=network;
},
get_mac:function(){
return this._mac;
},
set_mac:function(mac){
this._mac=mac;
},
get_hop_count:function(){
return this._hop_count;
},
set_hop_count:function(hop_count){
this._hop_count=hop_count;
},
get_mqueue:function(){
return this.mqueue;
},
set_mqueue:function(mqueue){
this._mqueue=mqueue;
},
generate_div:function(){
},
generate_xml:function(){
}
});
dojo.declare("DATALINK_MSTP","DATALINK", {
_mstp:'',
constructor: function(){
this._mstp=new MSTP();
},
get_mstp:function(){
return this._mstp;
},
set_mstp:function(mstp){
this._mstp=mstp;
},
generate_xml:function(){
}
});
dojo.declare("DATALINK_BIP","DATALINK", {
_bip:'',
constructor: function(/*id,type, network, mac, hop_count,mqueue,bip*/){
this._bip=new BIP();
},
get_bip:function(){
return this._bip;
},
set_bip:function(bip){
this._bip=bip;
},
generate_xml:function(){
}
});
我之前使用过Dojo工作得很好,但我在构造函数类中有一些参数(我已经测试了MSTP类,它工作正常)。谁能告诉我哪里出错了?
答案 0 :(得分:2)
试试这个:
dojo.declare("DATALINK_MSTP", DATALINK, {...});
dojo.declare("DATALINK_BIP", DATALINK, {...});