小编use*_*987的帖子

是否可以更改 JavaScript 对象的内部 [[Class]] 属性?

假设我已经创建了一个函数构造函数,例如

    function Bar(){
    }
    var obj = new Bar();
Run Code Online (Sandbox Code Playgroud)

有没有让Object.prototype.toString.call(obj)回报之类的东西[object Date]

javascript

3
推荐指数
1
解决办法
867
查看次数

如何在dojo中调用另一个方法的父方法

我怎么能在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");
}

});
Run Code Online (Sandbox Code Playgroud)

如何直接从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); …
Run Code Online (Sandbox Code Playgroud)

javascript dojo

1
推荐指数
1
解决办法
6685
查看次数

标签 统计

javascript ×2

dojo ×1