• extJS 创建类


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Welcome to Ext JS 5.0</title>
        <meta name="description" content="Create amazing web apps built on web standards. Sencha Touch, HTML5 mobile app framework. Ext JS, cross-browser JavaScript framework. Ext GWT" />
    
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
         <!-- 下面的文件都是下载好的extJs包中的 bulid目录下 -->
        <!-- 引入必须的css -->
        <link rel="stylesheet" href="build/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css" type="text/css" />
       
           <!-- 引入必须的js -->
        <script src="build/ext-all.js" type="text/javascript" charset="utf-8"></script>
        <script src="build/packages/ext-theme-crisp/build/ext-theme-crisp.js" type="text/javascript" charset="utf-8"></script>
        
    </head>
    <body>
        <script type="text/javascript">
            //在页面加载完成之后执行  
            //Ext.onReady(function(){  
            //    Ext.MessageBox.alert('hello','extJs 你好!');  
            //});
            /* var win = new Ext.Window(
                         {
                             400,
                              height:300,
                              title:"hello word",
                              buttons:[{text:"确定"},{text:"取消"}],
                         }
                     ); 
             win.show(); */
             
             Ext.onReady(function(){
                 
                 //定义一个类
                  Ext.define('Person',{
                      name:'jaune',
                      age:18,
                      //定义一个方法
                      see:function(){ alert('我的名字叫'+this.name); },
                      //构造函数
                      constructor:function(config){
                          //将配置的所有属性都复制到指定的对象
                          Ext.apply(this,config);
                      }
                  });
                  
                  Ext.define('Man',{
                      extend:'Person',
                      sex:'Male',
                      constructor:function(config){
                          if(config != null){
                            if(config.hasOwnProperty('sex')){  
                                delete config.sex;  
                            } 
                        }
                        
                          
                          this.callParent([config]);
                      },
                      toString:function(){
                          return {
                              name:this.name,
                              age:this.age,
                              sex:this.sex
                          }
                      }
                  });
                  
                  var man = new Man({
                    name:'zh',
                    age:12,
                    sex:'man'
                });
                  alert(man.toString().sex);
             });
        </script>
    </body>
    </html>

      

  • 相关阅读:
    python高级(2)—— 基础回顾2
    Java System Reports
    EWA不能及时通过邮件接收
    LA服务可用性4个9是什么意思?怎么达到?
    安装HANA Rules Framework(HRF)
    RFC destination fails with error Incomplete Logon Data after system copy
    为满足中国税改,SAP该如何打SPS
    HANA数据库无法停止
    SR开启时LOG_MODE必须是normal
    2743711
  • 原文地址:https://www.cnblogs.com/shaoshao/p/4103949.html
Copyright © 2020-2023  润新知