更新
sencha upgrade --check //检查是否有新的版本
sencha upgrade
生成项目
sencha -sdk ~/Documents/apache/sencha/ext-4.2.1.883 generate app MyApp ~/extjs/myapp
-sdk | extjs源码目录 |
MyApp | 项目名 |
~/extjs/myapp | 项目路径 |
生成model类
sencha generate model Customer id:int,name:string,notes:string
生成view 类
sencha generate view CustomerGrid
app.js
Ext.application({ name: 'PasswordBox', //项目名 extend: 'PasswordBox.Application', //继承此类 autoCreateViewport: true //自动创建(实例化) AppName.view.Viewport });
app/application.js
Ext.define('PasswordBox.Application', { //定义 PasswordBox.Application 类 name: 'PasswordBox', //项目名 extend: 'Ext.app.Application', //继承此类 views: [], controllers: [], stores: [] });
app/view/Viewport.js
Ext.define('PasswordBox.view.Viewport', { extend: 'Ext.container.Viewport', requires:[ 'Ext.layout.container.Fit', 'PasswordBox.view.Main' ], layout: { type: 'fit' }, items: [{ xtype: 'app-main' //创建 app-main 实例 }] });
app/view/Main.js
Ext.define('PasswordBox.view.Main', { extend: 'Ext.container.Container', requires:[ 'Ext.tab.Panel', 'Ext.layout.container.Border' ], xtype: 'app-main', //当前类的xtype 为 app-main layout: { type: 'border' }, items: [{ region: 'west', xtype: 'panel', title: 'west', width: 150 },{ region: 'center', xtype: 'tabpanel', items:[{ title: 'Center Tab 1' }] }] });
声明:转载请在明显位置给出本文 URL 地址。参照 CC署名 协议授权。