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

extjs constructor 基本靠猜测

先代码:

????? father 中有 constructor 的情况,之后将这里的注释掉

????? constructor:function(name){
???????? alert('father1\'s'+name);?
????? }

?

???? 没有注释,结果会是:

??? father1's2012-3-9

?

??? 注释掉:结果是:

?? grandfather constructor2012-3-9

?

?

  <script type="text/javascript">
    
    Ext.define('grandfather',{
       
        constructor:function(hello){
       alert('grandfather constructor'+hello);
    },
       testf:function(){
        alert('grandfather test');
       }
       });

    Ext.define('father1',{
      extend:'grandfather',
      constructor:function(name){
         alert('father1\'s'+name);
      },
     test:function(){
        alert('test');
     }
   });
        
        Ext.define('son',{
    extend:'father1',
   
    });

        
        var inson;
        Ext.onReady(function () {
	     inson=new son('2012-3-9');
        });
    </script>