1:到官网下载http://www.sencha.com/products/touch/download/,我下载最新版本2.3.1a;
二:建立文件夹目录结构如下
其他文件夹自行建立,touch-2.3是第一步官网下载解压而来。
三:编写代码:
1:index.html
wifiapp
2:app.js
/** * created by chongshi tan on 14-3-4. */ext.application( { name: 'wifiapp', controllers: ['wificontroller'], views: ['wifilistcontainer'], launch: function() { var wifilistcontainer = ext.create('wifiapp.view.wifilistcontainer'); ext.viewport.add(wifilistcontainer); }});
3:wifilistcontainer.js
/** * created by chonshi tan on 14-3-4. */ext.define(wifiapp.view.wifilistcontainer, { extend: 'ext.container', requires: ['ext.toolbar'], config: { items: [{ xtype: 'toolbar', docked: 'top', title: '开关列表', items: [{ xtype: 'spacer' },{ xtype: 'button', text: 'new', ui: 'action', iconcls: 'add', id: 'new-wifilist-btn' }] }] }});
4:wificontroller.js
/** * created by chongshi tan on 14-3-4. */ext.define('wifiapp.controller.wificontroller', { extend: 'ext.app.controller', launch: function() { this.callparent(); console.info(lauch); }, init: function() { this.callparent(); console.info('init'); }, config: { refs: { newwifibtn: #new-wifilist-btn }, control: { newwifibtn: { tap: 'onnewwifi' } } }, onnewwifi: function() { console.log(onnewwifi); }});
四:运行效果,火狐浏览器输入:http://localhost:63342/wifiapp/index.html
五:最后感谢
yanwushu博客教程:http://blog.csdn.net/yanwushu/article/category/1235170在他的代码上修改用最新的库做了一些改进和测试的demo,后续继续学习……