【发布时间】:2014-09-18 01:24:47
【问题描述】:
在我的应用中,我有两个重要的模型:ContentCollection 和 ContentItem。
每个 ContentCollection 都有许多 ContentCollections 和 ContentItem。您可以将 ContentCollections 视为文件夹,将 ContentItems 视为文件。所以,这种结构需要是可能的:
- ContentCollection
\- ContentCollection
\- ContentCollection
\- ContentCollection
\- Item
\- Item
\- ContentCollection
\- Item
- ContentCollection
\- Item
\- Item
- Item
- Item
我想为 ContentCollections 和 ContentItems 创建显示路线。
/home/collections/{id}
还有……
/home/items/{id}
还有……
/home/collections/{id}/collections/{id}/collections/{id}
还有……
/home/collections/{id}/collections/{id}/collections/{id}/items/{id}
等等。
有没有一种简单的方法可以优雅地处理主干路由中的这种嵌套?
【问题讨论】:
标签: javascript html backbone.js backbone-routing