当前位置: 代码迷 >> JavaScript >> extjs constructor 根本靠猜测
  详细解决方案

extjs constructor 根本靠猜测

热度:468   发布时间:2012-08-26 16:48:05.0
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>
  相关解决方案