zoukankan      html  css  js  c++  java
  • 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>

      

  • 相关阅读:
    Spring Security 自动装配
    Mysql学习
    java 学习路线(bilibili)
    Mac上配置idea的项目上传到GitHub
    vim安装自动补全插件
    spring aop 获取request、response对象
    centos7配置本地yum源 使用安装镜像安装软件
    eclipse启动速度优化
    spring-mvc springboot 使用MockMvc对controller进行测试
    java web 验证码-字符变形(推荐)
  • 原文地址:https://www.cnblogs.com/shaoshao/p/4103949.html
Copyright © 2011-2022 走看看