gpt4 book ai didi

extjs - 从 sencha sdk 创建所有类

转载 作者:行者123 更新时间:2023-12-04 20:52:16 26 4
gpt4 key购买 nike

我正在尝试使用 sencha sdk 来生成我的缩小文件。

我的页面设置在

http://www.mysite.localhost/ext/jobs/index.html

仅从 index.html 读取是不容易的。当我进入

sencha create jsb -a http://www.mysite.localhost/ext/jobs/index.html -p app.jsb3

我得到以下 jsb 文件。
{
"projectName": "Project Name",
"licenseText": "Copyright(c) 2011 Company Name",
"builds": [
{
"name": "All Classes",
"target": "all-classes.js",
"options": {
"debug": true
},
"files": []
},
{
"name": "Application - Production",
"target": "app-all.js",
"compress": true,
"files": [
{
"path": "",
"name": "all-classes.js"
},
{
"path": "",
"name": "app.js"
}
]
}
],
"resources": []
}

即它不包括我所有的类(class)。如果我更新

“路径”:“应用程序/”,
“名称”:“app.js”

app-all.js 已正确创建。但是我怎样才能得到 Controller 和 View 。有很多文件。有没有人有任何示例 mvc 应用程序 jsb。我的应用程序基于潘多拉。

应用程序/app.js
    Ext.Loader.setConfig({ enabled: true });
Ext.application({

name: 'Pandora',
models: ['Part', 'Material', 'Job', 'Process', 'Invoice', 'InvoiceDetail', 'PurchaseOrder'],
stores: ['SalesContact', 'Parts', 'Materials', 'Jobs', 'AccountHandlers', 'JobTypes', 'Processs', 'Artwork', 'Varnish', 'VarnishType', 'PrintType', 'ProofRequired', 'InvoiceDetails', 'PurchaseOrders'],
controllers: ['Part', 'Material', 'Job', 'Process', 'Invoice'],
launch: function () {

Ext.QuickTips.init();
var cmp1 = Ext.create('App.view.Jobs', {
renderTo: "form-job"
});
cmp1.show();
}

});

索引.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="ext-all-debug.js"></script>
<script type="text/javascript" src="app/app.js"></script>
</head>
<body>
<div id="form-job"></div>
</body>
</html>

最佳答案

更新

我们无需将所有内容都包含在 中就可以正常工作分机加载器() 在 app.js 中。确保您通过 分机加载器() 带有您的 Viewport 类的数组。仍然确保您正确使用:并要求:。这样你 jsb3 文件的最终输出就包含了所有内容。

我设法解决了这个问题。我需要使用 分机加载器() 在我的 app.js 文件中。一般的想法是你需要告诉加载器你的源文件在哪里。确保您的类文件包含在构建中。基于您上面的 app/app.js 代码。

Ext.Loader.setConfig({ enabled: true });

// SDK builder required source files, use the class names.
Ext.Loader.require(['Pandora.view.Viewport']);

Ext.application({

name: 'Pandora',
models: ['Part', 'Material', 'Job', 'Process', 'Invoice', 'InvoiceDetail', 'PurchaseOrder'],
stores: ['SalesContact', 'Parts', 'Materials', 'Jobs', 'AccountHandlers', 'JobTypes', 'Processs', 'Artwork', 'Varnish', 'VarnishType', 'PrintType', 'ProofRequired', 'InvoiceDetails', 'PurchaseOrders'],
controllers: ['Part', 'Material', 'Job', 'Process', 'Invoice'],
launch: function () {

Ext.QuickTips.init();
var cmp1 = Ext.create('App.view.Jobs', {
renderTo: "form-job"
});
cmp1.show();
}

});

我发现在您的 View 和 Controller 类中,确保您是否有与您正在添加的 View 绑定(bind)的存储(如组合框) 项目 中的 View 本身初始化组件 你使用 需要:“MyApp.store.Users”为类(class)。否则您将收到奇怪的错误,因为 View 将在存储之前初始化。

Ext.Loader.require() 必须放在 之前分机申请 .使用模型和 Controller 完成所有设置后,您还需要添加 View 。

您现在应该处于创建 jsb3 文件的好位置,并看到您的模型、 View 和 Controller 现在是构建过程的一部分。

关于extjs - 从 sencha sdk 创建所有类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9180469/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com