inheritableStatics 与statics类

/** 
         * statics 可以包含类的静态和静态方法,但是不能被子类继承 
         * inheritableStatics 与statics类似但是可以被子类继承 
         */  
 		Ext.onReady(function(){
 			Ext.define('DateUtil',{
                inheritableStatics:{
                    currentDate : Ext.Date.format(new Date(),'Y-m-d'),
                    getCurrentDate:function(formatStr){
                        if (Ext.isString(formatStr)) {
                            Ext.Date.format(new Date(), formatStr);
                        }else{
                            return this.currentDate;
                        }

                    }
                }
            })
 			
            
            //alert(DateUtil.currentDate);
 		    Ext.define('TimeUtil',{
                extend:'DateUtil',
                statics:{
                    currentTime : Ext.Date.format(new Date(),'Y-m-d H:i:s'),
                }
            });
            alert(TimeUtil.currentDate);
            alert(TimeUtil.currentTime);
        });

  

posted on 2014-11-17 17:04  邵邵  阅读(301)  评论(0编辑  收藏  举报

淘宝美工兼职招聘