zoukankan      html  css  js  c++  java
  • 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();
  • 相关阅读:
    带你走进Ajax
    基础
    基础
    基础-文字
    C++ part6.5
    操作系统 part4
    操作系统 part3
    计算机网络 part3 HTTP&HTTPS
    计算机网络 part2
    计算机网络 part1 TCP
  • 原文地址:https://www.cnblogs.com/zyip/p/3531862.html
Copyright © 2011-2022 走看看