【问题标题】:How to implement folder structure for Sencha Touch projects?Sencha Touch项目如何实现文件夹结构?
【发布时间】:2014-12-15 07:47:26
【问题描述】:

我正在构建一个 Sencha Touch 项目。 Sencha Touch 命令行可让您创建控制器、视图、模型、商店,但没有标准的方法来构建项目。我想将我的所有路由放在一个文件中,比如 app.routes.js。 在一个文件中加载视图的主控制器,比如 ma​​inController.js,我想在其中编写代码来加载不同的视图。

我还想将所有模板保存在一个文件中,以便 UI 设计人员将其保存在一个文件中,例如 app.templates.html 以便我可以追加模板文件以在加载时记录头使用标准 jQuery 访问不同的布局和视图。我浏览了不同的答案,但没有找到任何相关的答案。

这是实现路由器的方式-

Ext.Viewport.setActiveItem({xtype : 'main'});
    break;
    case '#_login':
        Ext.Viewport.setActiveItem({xtype : 'login'});
        break;
    case '#_terms':
        Ext.Viewport.setActiveItem({xtype : 'terms'});
        break;
    case '#_exams':
        Ext.Viewport.setActiveItem({xtype : 'exam'});
        break;
    case '#_enrollments':
        Ext.Viewport.setActiveItem({xtype : 'enroll'});
        break;
    case '#_examdetails':
        Ext.Viewport.setActiveItem({xtype : 'exammaterials'});
        break;
    case '#_enrollmentdetails':
        Ext.Viewport.setActiveItem({xtype : 'enroll'});
        break;
    case '#_mapdetails':
       Ext.Viewport.setActiveItem({xtype : 'mapview'});
        break;

【问题讨论】:

    标签: javascript jquery extjs mobile sencha-touch


    【解决方案1】:

    如果您在开始时使用Sencha Cmd to create the project,您将使用所需的文件夹结构进行设置。

    在终端中:

    sencha -sdk /path/to/touch-x.x.x generate app MyApp /path/to/www/myapp

    您将使用这样的目录结构进行设置...

    MyApp/
      |_ app/
      | |_ controller/
      | |_ model/
      | |_ store/
      | |_ view/
      |_ build/
      |_ packages/ ...
      |_ resources/ ...
      |_ touch/ ... <-- this folder is also generated for you.
      |_ app.js
      |_ app.json
      |_ bootstrap.js
      |_ bootstrap.json
      |_ build.xml
      |_ index.html
      |_ packager.json
    

    我不确定将模板保存在一个文件中,但我看到有人说他们可以将模板保存在 index.html 文件中的脚本标记中并以某种方式引用它。不确定它是如何工作的。

    【讨论】:

      猜你喜欢
      • 2013-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-09
      相关资源
      最近更新 更多