• classes system in sencha touch


    //http://www.sencha.com/learn/sencha-class-system
    var Person = new Ext.Class({
        name: 'Mr. Unknown',
        walk: function(steps) {
            alert(this.name + ' is walking ' + steps + ' steps');
        }
    });
    
    
    //http://docs.sencha.com/touch/2.2.1/#!/guide/class_system
    //Ext.ns('My.sample');//define the namespace
    Ext.define('Animal', {
    
        requires: [
            'Ext.MessageBox'
        ],
        
        constructor: function(config) {
            this.initConfig(config);
        },
        
        config: {
            name: 'default name',
            gender:'male'
        },
    
        
        speak: function() {
            //alert('grunt');
            Ext.Msg.alert(this.getName(), "Speaks...");
        },
        
        statics : {
            
           static1  :function(){    
                console.log('static fun1, called by Animail.static1');
            }
        } 
    });
    
    console.log('launching...');
    Animal.static1();
    var ani=Ext.create('Animal',{name:'abc'});
    console.log(ani.getName());
    ani._name='zhaoyao';
    console.log(ani.getName());
    console.log(ani._gender);
    ani.speak();
  • 相关阅读:
    mysql5.6 TIME,DATETIME,TIMESTAMP
    CMake 简单介绍 图
    mysql 源码编绎修改 FLAGS,调试MYSQL
    CHAR 详解
    关于MySQL的各种总结
    Shell编程速查手册
    cmake 手册系列
    编译安装GCC 5.2.0
    宽字符相关的输入输出
    Makefile
  • 原文地址:https://www.cnblogs.com/zyip/p/3531862.html
Copyright © 2020-2023  润新知