我如何在 dojo 中调用另一个方法的父方法。考虑以下示例:
var parent = declare(null,{
m1: function(arg){
console.log("parent.m1");
},
m2: function(arg){
console.log("parent.m2");
}
});`enter code here`
var child = declare(parent,{
m1: function(arg){
console.log("child.m1");
// how can i call parent.**m2** here directly without calling child.m2
},
m2: function(arg){
console.log("child.m2");
}
});
我怎么能直接从 child.m1 调用 parent.m2 而不调用 child.m2
现在假设我定义两个模块如下:
parentModule.js
var parent = declare(null,{
m1: function(arg){
console.log("parent.m1");
},
m2: function(arg){
console.log("parent.m2");
}
});
return declare("ParentModule",[parent,child]);
//******************************************//
childModule.js
return declare("child",null,{
m1: function(arg){
console.log("child.m1");
// how can i call parent.**m2** here directly without calling child.m2
//if we call ParentModule.prototype.m2.call(this,arguments); this will call child.m2
//as child module override the parent now
//also calling this.getInherited("m2",arguments); will call child.m2 !!!
//how to fix that?
},
m2: function(arg){
console.log("child.m2");
}
});