本文介绍了Ember.js路由器应用架构 - 如何有多重嵌套视图/控制器对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个余烬应用和出口的概念,并连接电源插座是好的,我明白了。我不明白的是如何有多个视图/另一个内部控制视图,而不疯狂的嵌套

I have an ember app and the concept of the outlet and connecting the outlet is fine, I get that. What I don't understand is how to have more than one view/controller view inside of another one without insane nesting

假如我设计的icloud克隆在那里我有电子邮件功能以及相册功能。现在,如果我想要完成的类似

Suppose I am designing icloud clone where I have email functionality and a photo gallery functionality. Now if I wanted to accomplish something like

***********************************************************
* INBOX LIST     **  COMPOSE OR VIEW MESSAGE              *
*                **                                       *
*                **                                       *
*                **                                       *
*                **                                       *
* CONTACTS LIST  **                                       *
*                **                                       *
*                **                                       *
*                **                                       *
*                **                                       *
***********************************************************

这是我想设计,这将是类似

The way that I would want to design this would be something like

EmailController/View
|-- SplitViewController/View
   |-- InboxListController/View
   |-- ContactsListController/View
   |-- ComposeMessageController/View
   |-- ReadMessageController/View

我在哪里可以热插拔,这些对列SplitView的水平或产品总数删除它们,但我没有看到只允许一个出口这样做的一个好办法。这会迫使我接下来的事情就的东西,不应该被嵌套。使用单一的出口方式,我的结构将更像

Where I can hot swap these to the level of the SplitView or remove them alltogether, but I don't see a good way of doing this with only one outlet allowed. It would force me next things inside of things that should not be nested. Using the single outlet approach, my structure would look more like

EmailController/View
|-- SplitViewController/View
   |-- InboxListController/View
       |-- ContactsListController/View
           |-- ComposeMessageController/View
               |-- ReadMessageController/View

我怎么会发现,与Ember.js /路由器适合的建筑风格仍允许更复杂的嵌套?

How would I find an architecture style that fits with Ember.js/Router that still allows for more complex nesting?

推荐答案

你知道你可以命名的出路?例如,在列SplitView模板,你可以有一个{{出口inboxListView}}一{{出口contactsListView}}等等...当你做你的connectOutlets的东西,你可以做到这一点,如:

Do you know you can name the outlets ? For example, in SplitView template, you can have one {{outlet inboxListView}}, one {{outlet contactsListView}} etc... when you do your connectOutlets stuff, you can do this like:

splitViewController.connectOutlet({name: 'inboxList', outletName: 'inboxListView'})
splitViewController.connectOutlet({name: 'contactsList', outletName: 'contactsListView'})

等等...

这篇关于Ember.js路由器应用架构 - 如何有多重嵌套视图/控制器对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 17:22