1. JS class declaration, and object creation 2. The original method uses EXTJS to create a window 3. Use a button to trigger the window form, understand the event mechanism of EXTJS 4. Use the create of EXTJS4.0 to create a window 5. Use define custom class and integrate (extend)window // initialization method initComponent: function () { this .callParent(arguments); } 6 .requires JS asynchronous loading 7 .config automatic get and set 8.mixins class mix
// //The declaration of a class is actually a function // function user(){ // //public in the java language // this.Name = 'uspcat'; // this.age = 26; // //var is Relative to private in high-level languages // var email = "[email protected]" // this.getEmail = function(){ // return email; // } // } // var u = new user(); // //alert(u.getEmail()) // //var person = { // name:'yfc' // ,age:26 //}; //alert(person.name+" "+person['age']) (function(){ Ext.Loader.setConfig({ enabled:true, paths:{ myApp:'code/ux' } }); Ext.onReady(function(){ /** var win = new Ext.window.Window({ width:400, height:300, title:'uspcat' }); // win.show(); //1. Get the dom object of that button //2. Add a click event to the button object //3. When you click, call the show method of the object win Ext.get("myb").on("click",function(){ win.show(); }); */ // var o = { // say : function(){ // alert(11111); // } // } // var fn = Ext.Function.alias(o,'say'); // fn(); // var win = Ext.create('Ext.window.Window',{ // width:400, // height:300, // title:'uspcat' // }); // win.show(); Ext.get("myb").on("click",function(){ var win = Ext.create("ux.myWin",{ title:'my win', price:600, requires:['ux.myWin'] }); //alert(win.getPrice()) }); Ext.define("say",{ cansay:function(){ alert("hello"); } }) Ext.define("sing",{ sing:function(){ alert("sing hello 123"); } }) Ext.define('user',{ mixins :{ say : 'say', sing: 'sing' } }); var u = Ext.create("user",{}); u.cansay(); u.sing(); }); })();