// extjs程序入口 extRoot = app.basePath+"/jslib/ext-4.2.1"; // 配置动态加载路径 Ext.Loader.setConfig({ enabled: true, paths: { 'Ext.ux': extRoot + '/ux', 'somnus':app.basePath+'/app' } }); Ext.onReady(function () { Ext.application({ name: 'somnus',//定义一个全局命名空间 somnus appFolder: 'app', autoCreateViewport: true, controllers: [], launch: function() {} }); });
Ext.define('MyClass.A',{ showA:function(){ console.log('A'); } }); Ext.define('MyClass.B',{ showB:function(){ console.log('B'); } }); Ext.define('MyClass.C',{ mixins:['MyClass.A','MyClass.B'] showC:function(){ console.log('C'); } }); var c = Ext.create('MyClass.C'); c.showA(); c.showB(); c.showC();
<span style="font-family:Courier New;font-size:14px;">Ext.define('somnus.User',{ remark:'', config:{ username:'aa', password:'123456' }, constructor:function(cfg){ this.initConfig(cfg) } }); var user = Ext.create('somnus.User',{ username:'bb', password:'123456' remark:'xxxx' }); console.log(user.remark); console.log(user.getUsername()); console.log(user.getPassword());</span>
Ext.define('MyApp.CoolPanel',{ extend:'Ext.panel.Panel', alias:['widget.coolpanel'], title:'Yeah' }); Ext.create('widget.coolpanel'); Ext.widget('coolpanel');
items:[ Ext.create('Ext.form.filed.Text',{ filedLabel:'foo1' }), Ext.create('Ext.form.filed.Text',{ filedLabel:'foo2' }), Ext.create('Ext.form.filed.Text',{ filedLabel:'foo3' }) ] //上面的创建方式改为xtype items:[ { xtype:'textfield', filedLabel:'foo1' },{ xtype:'textfield', filedLabel:'foo2' },{ xtype:'textfield', filedLabel:'foo3' } ]