gpt4 book ai didi

javascript - 如何实现 Sencha Touch 项目的文件夹结构?

转载 作者:行者123 更新时间:2023-11-28 19:27:51 25 4
gpt4 key购买 nike

我正在构建一个 Sencha Touch 项目。 Sencha Touch 命令行允许您创建 Controller 、 View 、模型、存储,但没有架构项目的标准方法。我想将所有路由放在一个文件中,例如 app.routes.js。 在一个文件中加载 View 的主 Controller ,例如ma​​inController.js,我想在其中编写代码来加载不同的 View 。

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

这是如何实现路由器的-

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;

最佳答案

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

在终端中:

sencha -sdk/path/to/touch-x.x.x 生成应用程序 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 文件中,并以某种方式引用它。不确定这是如何运作的。

关于javascript - 如何实现 Sencha Touch 项目的文件夹结构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27479475/

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