Extjs基礎知識

來源:互聯網
上載者:User

一、環境的搭建

從官網下載Extjs 4.1 的工具包,裡面的東西很多,我們在開發階段並不需要太多的東西,因此保留 了我們需要用到的最少的幾個檔案:

其中resources為資源和一些Extjs樣式檔案,local為語言套件,Extjs4.0新增加了bootstrap.js這樣一 個檔案,我們可以看下它的源碼來瞭解一下它的作用:

if (isDevelopment === null) {        for (i = 0, ln = localhostTests.length; i < ln; i++) {            test = localhostTests[i];                if (host.search(test) !== -1) {                isDevelopment = true;                break;            }        }    }        if (isDevelopment === null && window.location.protocol === 'file:') {        isDevelopment = true;    }        document.write('<script type="text/javascript" charset="UTF-8" src="' +         path + 'ext-all' + (isDevelopment ? '-dev' : '') + '.js"></script>');

我們可以瞭解到,其實它的作用就是判斷我們是處於開發模式還是偵錯模式,然後動態給我們引入 所需要的js檔案。因此如果我們需要在頁面內編寫Extjs,只需要為Extjs引入這樣兩個檔案:

<link rel="stylesheet" type="text/css" href="../ext/resources/css/ext-all.css">
<script type="text/javascript" src="../ext/bootstrap.js"></script>

這樣我們最簡單的一個環境就搭建完成了。

二、Hello World

學習每個語言必定都是從Hello World開始的,在javascript中我們使用alert來彈出提示框,而在 Extjs中我們採用如下的方式:

1 (function(){
2     Ext.onReady(function(){
3         Ext.MessageBox.alert("hello","Hello World! ");
4         })
5 })();

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.