Ext class Class Configuration item: ( Note: ExtJS's Chinese help document: http://download.csdn.net/detail/z1137730824/7748893
ExtJS configuration file and example: http://download.csdn.net/detail/z1137730824/7754771 )
Grammar:
Define ( String className, Object data, Function CREATEDFN )
Instance:
Ext.onready (function () {///syntax: define (String className, Object data, function CREATEDFN) ext.define (' person ', {// For the configuration information for the Class//config property: Configures the property contents of the current class, and automatically adds the Get and set methods Config:{name: ' Zhang San ', age:30},//the method of its own definition mymethod:function () {alert (' This is your own definition of the method ');},//adds the constructor constructor:function (config) {var me=this;//to the currently defined class//can view the contents of the configuration item//for (var attr in config )//{//alert (attr+ ":" +config[attr]);//}me.initconfig (config);//True initialization of the passed in Parameters});// Ext recommended methods for instantiating objects: Ext.createvar p=ext.create (' person ', {//class name of the class you defined name: ' instantiated name ',//config item age:100}); alert (' Name: ' + P.getname () + '--age: ' +p.getage ());//Call the Get method added by default P.mymethod ();//Invoke its own defined method});
Operation result;