posts - 8, comments - 0, trackbacks - 0, articles - 11

          Extjs4特性介紹二

          Posted on 2012-04-06 14:32 a_alter 閱讀(175) 評(píng)論(0)  編輯  收藏 所屬分類: ExtJs

          Mixins

          官方文檔介紹

          This is a new approach to plugging custom functionality into existing classes. The new mixins config, included during instantiation of a class, allows you to "mix in" new capabilities to the class prototype. This is similar to the existing Ext.override function, although it does not replace existing methods like override does, it simply augments the prototype with whatever is new.       

           == java override , 不過(guò)支持多繼承。 相同方法取最后實(shí)現(xiàn)。

          Statics

          靜態(tài)字段和方法定義塊。
          Ext.define('Person',{
             statics:{
                staticAttribute:'靜態(tài)變量',
                staticFunction:
          function(){
                  
          // 靜態(tài)方法
                }
             }
          });

          alert(Person.staticAttribute);

          Config

          這個(gè)理解為 java 的pojo中的變量, 可以自動(dòng)生成以下方法, 以下代碼摘官方文檔。

          usage
          Ext.define('MyClass', {
              config: {
                  title: 'Default Title'
              }
          });
          自動(dòng)生成以下代碼
          title: 'Default Title',

          getTitle: 
          function() {
              
          return this.title;
          },

          resetTitle: 
          function() {
              
          this.setTitle('Default Title');
          },

          setTitle: 
          function(newTitle) {
             
          this.title = this.applyTitle(newTitle) || newTitle;
          },

          applyTitle: 
          function(newTitle) {
              
          // custom code here
              // e.g. Ext.get('titleEl').update(newTitle);
          }

          檢測(cè)用戶的使用環(huán)境  相關(guān)見(jiàn)API文檔
          • Ext.env.Browser
          • Ext.env.FeatureDetector
          • Ext.env.OS



          主站蜘蛛池模板: 吉水县| 枝江市| 荔波县| 喀什市| 周宁县| 陕西省| 安顺市| 昭苏县| 安新县| 大冶市| 镇平县| 淳化县| 瑞丽市| 苍溪县| 潼南县| 日土县| 和田县| 罗城| 南充市| 嵩明县| 永福县| 舞阳县| 柏乡县| 陇西县| 屯昌县| 平南县| 四会市| 河北省| 绥阳县| 宿松县| 威宁| 海阳市| 朝阳区| 临清市| 买车| 丹江口市| 伊通| 华坪县| 吕梁市| 河津市| 巢湖市|