离子大项目结构

Ionic big project structure

我正在构建一个移动应用程序,它是网络应用程序的一个端口,我正在尝试创建框架。

我有一个管理中心,有很多不同的视图,它们有一个共同点,它们显示所有寄存器、创建、更新和删除。例如,我有一个用户部分,第一页显示所有用户,然后有一个创建按钮和一个发送到不同视图的更新按钮。

项目框架应该是这样的:

/users
    users.html // show all users
    users_create.html // creates user
    users_update.html // update specific user
    users_detail.html // show specific user
/posts
    posts.html
    posts_create.html
    posts_update.html
    posts_detail.html
/communities
    communities.html
    communities_create.html
    communities_update.html
    communities_detail.html

.... much more the same for other sections

我的问题是,用 ionic 构建它的最佳方法是什么?要拥有所有这些文件夹或只有一个公共文件夹并通过将参数传递给路由来解析所有内容(字段数、字段名称等)?

如果我解释得不够好,请您见谅,但我希望您能理解我想说的意思。

谢谢!

从这本很棒的书 MEAN Web Development by Amos Haviv 中,您可以了解到基本上有两种文件夹结构可供选择:

  • 水平文件夹结构

A horizontal project structure is based on the division of folders and files by their functional role rather than by the feature they implement, which means that all the application files are placed inside a main application folder that contains an MVC folder structure. As you can see, the horizontal folder structure is very useful for small projects where the number of features is limited, and so files can be conveniently placed inside folders that represent their general roles.

  • 垂直文件夹结构

A vertical project structure is based on the division of folders and files by the feature they implement, which means each feature has its own autonomous folder that contains an MVC folder structure.

所以,在你的情况下,我实际上会做的是使用垂直文件夹结构(因为你说应用程序(将会)很大,你会(在你的情况下)有一个 users 文件夹,您将在其中拥有文件夹 controllersviewsmodel(如果您正在使用它)以及其中的所有相应文件。您可以查看文件夹结构如果您看一下与本书作者相同的项目 mean.js,就会发生作用。