我是Ext JS的新手。
我有:
Sencha命令4.0.0.203
分机号:4.2.1.883
SenchaSDK工具-2.0.0测试版3
卢布193
我在指南页面上阅读了ExtJS文档,这里是hello world示例:
http://docs.sencha.com/extjs/4.2.1/#!/guide/getting_started
所以我创建了一个文件夹
你好,你好
name,并将ext-4.2.1.883内容放入
外部js
在里面和
应用程序.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.'
}
]
});
}
});
最后,我创建了一个
索引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>
所以我的包装结构是:
-
你好,你好
-
应用程序.js
-
索引html
-
extjs(文件夹)
那个
外部js
(文件夹)包含所有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:这个文件是应用程序的最小化版本
运行它所需的所有ExtJS类。它是缩小的和
所有classes.js+app.js的生产就绪版本。
我检查了此文件大小:
所有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)
那么,我在部署时有什么错呢?
我很感激你的帮助。