Ext.expend()

学习来源:    http://wangyu.iteye.com/blog/210849

 

Ext.extend 是Ext的继承机制,一般有两种用法:

1. C=Ext.extend(S,{s1:"覆盖"});

<script type="text/javascript">
    function S(){ 
    }
    S.prototype.s="s";
    S.prototype.s1="s1";
    C=extend(S,{s1:"覆盖"});
    var c = new C();
    alert(c.s);
    alert(c.s1);
</script>

 

2. Ext.extend(C,S,{s1:"覆盖"});

<script type="text/javascript">   
            function S(){   
            }   
            S.prototype.s = "s";   
            S.prototype.s1 = "s1";   
            function C(){   
                this.c = "c";   
                this.c1 = "c1";   
            }   
            Ext.extend(C,S,{s1:"覆盖"});   
            var c = new C();   
            alert(c.s);   //s   
            alert(c.s1); //覆盖
</script>  

 

posted @ 2017-07-20 10:10  zhengmengen  阅读(207)  评论(0)    收藏  举报