日期:2014-05-16  浏览次数:20346 次

superclass.constructor.call(this,config),参数问题
JScript code

function Base(config){
        this.name=config.name;
        this.age=config.age;
        this.password=config.password;
    }
    function base(config){
        this.a=config.a;
        this.b=config.b;
        this.c=config.c;
        base.superclass.constructor.call(this,config);//第一个参数this是什么意思?不太明白
    }
    Ext.extend(base,Base,{
        showMessage:function(){
            window.alert("name="+this.name+" a="+this.a);
        }
    });


大哥大姐们,说明一下

------解决方案--------------------
探讨
JScript code

function Base(config){
this.name=config.name;
this.age=config.age;
this.password=config.password;
}
function base(config){
this.a=config.a……

------解决方案--------------------
改变作用域,参考
JavaScript变量函数预编译与执行顺序的关系
------解决方案--------------------
探讨
引用:
比如
var a = new base();

那个this就是a对象~·

我是说这个里为什么要用THIS,不是不知道this代表什么

------解决方案--------------------
探讨
JScript code

function Base(config){
this.name=config.name;
this.age=config.age;
this.password=config.password;
}
function base(config){
this.a=config.a……