讓我們想象一個處理以下平臺的ng2應用程序:web,mobile-web和mobile-native。Angular2應用程序體系結構(網頁,手機,原生)
由於事實上有很多共享文件(比如動作創建者,reducer ...,服務,通用組件), 所有內容都可以放在一個存儲庫中。在大多數情況下,組件和路由中的web,移動web和移動原生視圖登錄存在差異。 一切都由webpack管理,它使用.mobile.ts和.desktop.ts擴展來構建所有的東西。帶有.base.ts擴展名的文件包含桌面和移動組件之間的共享視圖邏輯。
電流(簡體)文件結構如下(桌面網頁版,手機是移動網絡):
assets/
app/
/common
actions/
enums/
models/
effects/
pipes/
reducers/
services/
components/
account-list/
account-item/
account-item.component.base.ts
account-item.component.desktop.ts
account-item.component.desktop.html
account-item.component.mobile.ts
account-item.component.mobile.html
index.ts
account-list.component.base.ts
account-list.component.desktop.ts
account-list.component.desktop.html
account-list.component.mobile.ts
account-list.component.mobile.html
index.ts
/modules
/desktop
/accounts
accounts.component.desktop.ts
accounts.component.desktop.html
accounts.routes.desktop.ts
index.ts
/mobile
/accounts
accounts.component.mobile.ts
accounts.component.mobile.html
accounts.routes.mobile.ts
index.ts
app.component.desktop.ts
app.component.mobile.ts
app.module.desktop.ts
app.module.mobile.ts
app.routes.desktop.ts
app.routes.mobile.ts
正如你可以看到,文件的數量增長如此之快。我害怕通過添加另一個本地平臺來考慮它的外觀。不幸的是,我無法找到任何有趣的案例。
,我已經找到了只有一個: Angular2 advanced seed link
但似乎preety怪異和不直觀的爲好。
對於這種情況,你有什麼建議如何使結構更好?我會很感激任何幫助。謝謝你的建議。
您是否嘗試過使用您對項目結構的建議來構建應用程序?如果是這樣,你會推薦使用它嗎? – Weissvonnix