【发布时间】:2013-10-23 10:30:28
【问题描述】:
我是 Ext JS 的新手。 我有:
煎茶 Cmd 4.0.0.203
Extjs 4.2.1.883
SenchaSDKTools-2.0.0-beta3
Ruby193
我在这里阅读了 hello world 示例指南页面上的 Ext JS 文档:
http://docs.sencha.com/extjs/4.2.1/#!/guide/getting_started
所以我在 Tomcat 的 webapp 中创建了一个名为 helloext 的文件夹,并将 ext-4.2.1.883 的内容放入其中的 extjs 和一个 app.js 文件夹旁边的文件,内容如下:
Ext.require('Ext.container.Viewport');
Ext.application({
name: 'HelloExt',
launch: function() {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
title: 'Hello Ext',
html : 'Hello! Welcome to Ext JS.'
}
]
});
}
});
最后我用这个内容创建了一个 index.html:
<html>
<head>
<title>Hello Ext</title>
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/ext-debug.js"></script>
<script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>
所以我的包装结构是:
- helloext
- app.js
- index.html
- extjs(文件夹)
extjs(文件夹)包含所有 ext-4.2.1.883 内容。
当我在浏览器地址栏中输入这个地址http://localhost:8080/helloext/index.html时,一切正常。
执行以下命令时:
sencha create jsb -a index.html -p app.jsb3
sencha build -p app.jsb3 -d .
我收到这条消息,似乎一切正常并已完成!
D:\application server\apache-tomcat-7.0.41\webapps\helloext>
sencha create jsb -a index.html -p app.jsb3
D:\application server\apache-tomcat-7.0.41\webapps\helloext>
sencha build -p app. jsb3 -d .
Loading the Project Name Project
Loaded 0 Packages
Loaded 2 Builds
* Parse all-classes.js with options:
- debug: true
- debugLevel: 1
* Parse app-all.js with options:
- debug: false
- debugLevel: 1
* Compress and obfuscate app-all.js...
Copy resources...
Done building!
D:\application server\apache-tomcat-7.0.41\webapps\helloext>
第一个命令创建一个 jsb3 文件,第二个命令创建两个文件:
all-classes.js
and
app-all.js
文件说:
all-classes.js:此文件包含您应用程序的所有类。 它没有缩小,因此对于调试您的问题非常有用 构建的应用程序。在我们的示例中,这个文件是空的,因为我们的 “Hello Ext”应用程序不包含任何类。
app-all.js:此文件是您的应用程序的最小化构建加上 运行它所需的所有 Ext JS 类。它是缩小和 all-classes.js + app.js 的生产就绪版本。
我检查了这个文件大小:
all-classes.js 大小为 2.39 MB
app-all.js 大小约为 500 KB。
我用这个内容创建了 index-prod.html 文件:
<html>
<head>
<title>Hello Ext</title>
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/ext.js"></script>
<script type="text/javascript" src="app-all.js"></script>
</head>
<body></body>
</html>
并使用此 URL 访问它:
http://localhost:8080/helloext/index-prod.html
除了控制台中的 Firefox 和 Chrome 出现这个错误外,我什么也没得到???
火狐:
TypeError: Ext.cmd is undefined
TypeError: Ext.EventManager is undefined
铬:
Uncaught TypeError: Cannot call method 'derive' of undefined
(anonymous function)
Uncaught TypeError: Cannot call method 'onWindowResize' of undefined app-all.js:4
Ext.define.constructor app-all.js:4
i ext.js:21
(anonymous function) app-all.js:4
Ext.ClassManager.processCreate ext.js:21
Ext.ClassManager.processCreate ext.js:21
(anonymous function) ext.js:21
Ext.apply.onBeforeCreated ext.js:21
Ext.apply.doProcess ext.js:21
Ext.apply.process ext.js:21
Ext.Class.c ext.js:21
Ext.ClassManager.create ext.js:21
Ext.apply.define ext.js:21
(anonymous function)
那么我的部署有什么问题呢?
感谢您帮助我。
【问题讨论】: