我是Ext JS的新手。 我:Ext JS 4.2.1部署
煎茶Cmd的4.0.0.203
ExtJS的4.2.1.883
SenchaSDKTools-2.0.0-β3
Ruby193
我阅读指南页面的Ext JS文件hello world example here:
http://docs.sencha.com/extjs/4.2.1/#!/guide/getting_started
所以我在我的Tomcat Web应用程序的创建一个文件夹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
文件称:
全classes.js:此文件包含所有的你的应用程序的类。 它不会被缩小,因此对于调试您的内置应用程序的问题非常有用。在我们的例子中,这个文件是空的,因为我们的 “Hello Ext”应用程序不包含任何类。
app-all.js:该文件是应用程序的最小编译版本,另外还有运行它所需的所有Ext JS类别 。它是所有classes.js + app.js.的生产就绪版本的缩小版和 。
我检查这个文件大小:
全classes.js大小为2.39 MB APP-all.js大小为500 aboub KB。
我创建索引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>
和访问使用该网址是:
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)
那么,什么是我的错部署?
我很感谢你帮助我。
感谢您在短时间内回答。我用它,但在命令执行结束时出错。 > sencha -s“d:\ Program Files(x86)\ SenchaSDKTools-2.0.0-beta3”生成应用程序MyApp e:\ exttest ... [INF] [propertyfile]更新属性文件: e:\ exttest \ .sencha \工作空间\ sencha.cfg [INF] [INF]复制框架到工作区: [INF] [INF]生成工作空间: [INF] [INF] -after -generate-workspace: [ERR]无法找到sencha的'framework.dir'属性。CFG [ERR]请确保该命令是从一个有效的框架执行 目录 [ERR]非框架目录 –
我想你遇到了这个问题,因为你没有运行在Web根目录下的命令,因为你为你的应用文件夹提供了绝对路径。我在答案中增加了更多精确的信息。我希望这有帮助。 –