sencha touch2.3.1入門學習(1)

來源:互聯網
上載者:User

1:到官網下載http://www.sencha.com/products/touch/download/,我下載最新版本2.3.1a;


二:建立檔案夾目錄結構如下

其他檔案夾自行建立,touch-2.3是第一步官網下載解壓而來。

三:編寫代碼:

1:index.html

<!DOCTYPE html><html><head>    <meta charset="utf-8">    <title>wifiApp</title>    <link rel="stylesheet" type="text/css" href="touch-2.3/resources/css/sencha-touch.css">    <script type="text/javascript" src = "touch-2.3/sencha-touch-debug.js"></script>    <script type="text/javascript" src="app.js"></script></head><body></body></html>

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");    }});

四:運行效果,Firefox瀏覽器輸入:http://localhost:63342/wifiapp/index.html


五:最後感謝

yanwushu部落格教程:http://blog.csdn.net/yanwushu/article/category/1235170

在他的代碼上修改用最新的庫做了一些改進和測試的demo,後續繼續學習……

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.