从 sencha sdk 创建所有类

发布于 2025-01-03 12:10:40 字数 2369 浏览 3 评论 0原文

我正在尝试使用 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": []
}

即它不包括我所有的课程。如果我更新

“path”:“app/”, "name": "app.js"

app-all.js 已正确创建。但我怎样才能获得控制器和视图。有很多文件。有没有人有任何示例 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>

I'm trying to use the sencha sdk to generate my minified file.

I have my page set up on

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

reading from just index.html is not easily possible. When i enter

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

I get the following jsb file.

{
    "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": []
}

ie it's not included all my classes. If i update

"path": "app/",
"name": "app.js"

app-all.js is created correctly. But how can i get the controllers and views. There are a lot of files. Does any one have any example mvc application jsb. My app is base on pandora.

app/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();
        }

    });

index.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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执笔绘流年 2025-01-10 12:10:40

更新

我们无需将 Ext.Loader() 中的所有内容包含在 app.js 中即可实现此功能。确保使用 Viewport 类向 Ext.Loader() 传递一个数组。仍然确保您执行正确的用途:要求:。这样,jsb3 文件的最终输出就包含了所有内容。

我设法解决了这个问题。我需要在我的 app.js 文件中使用 Ext.Loader() 。一般的想法是你需要告诉加载器你的源文件在哪里。确保您的类文件包含在构建中。基于您上面的 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();
    }

});

我发现在您的视图和控制器类中,请确保您是否有与视图(如组合框)相关联的存储,并且您正在将 items 添加到 initComponent 中的视图本身并且您对该类使用requires: 'MyApp.store.Users'。或者您会收到奇怪的错误,因为视图将在存储之前初始化。

Ext.Loader.require() 必须放在Ext.Application 之前。一旦你完成了模型和控制器的所有设置,你也会想要添加你的视图。

您现在应该可以很好地创建 jsb3 文件,并看到您的模型、视图和控制器现在已成为构建过程的一部分。

Update

We got this working without the need for including everything in Ext.Loader() in app.js. Make sure you pass Ext.Loader() an array with your Viewport class. Still make sure you do the correct uses: and requires:. That way you final output for the jsb3 file contains everything.

I managed to sort this out on my end. I needed to use the Ext.Loader() in my app.js file. The general idea is you need to tell the loader where your source files are. Making sure your class file's are included in the build. Based on your code above for 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();
    }

});

I found that in your view and controller classes make sure if you have stores tied to your view (like a combobox) that you are adding items to the view itself in the initComponent and you use the requires: 'MyApp.store.Users' for the class. Or you will receive strange errors as the view will initialize before the store.

The Ext.Loader.require() must be placed before the Ext.Application. Once you have it all setup with the models and controllers, you'll want to add your views too.

You should be in a good place to create your jsb3 file now, and see that your models, views, and controllers are now part of the process for the build.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文