简体   繁体   English

Aurelia 子路由器 - 用例

[英]Aurelia child router - use case

I have been doing some initial work to get to grips with the Aurelia framework and am trying to decide if I should be using child routers.我一直在做一些初步的工作来掌握 Aurelia 框架,并试图决定我是否应该使用子路由器。 This doesn't seem to be covered in much detail on the Aurelia router configuration page . Aurelia 路由器配置页面上似乎没有详细介绍这一点。 I was wondering if anyone has come across any good use case scenarios that I could examine to get a better understand of where and when to use this feature.我想知道是否有人遇到过任何好的用例场景,我可以检查这些场景以更好地了解何时何地使用此功能。

One scenario that springs to mind is 2nd level navigation.想到的一种情况是二级导航。 Say, for example, you have a main router for the top level sections of your app, eg:假设,例如,您有一个用于应用程序顶级部分的主路由器,例如:

  • Home
  • Products产品

Those sections could have a child router to handle the 2nd level pages - eg:这些部分可以有一个子路由器来处理第二级页面 - 例如:

  • Products产品
    • Aircraft飞机
    • Bombs炸弹
    • Guns
    • Tanks坦克

Having the sub-views (aircraft, bombs, etc) for the products view in their own child router allows you to easily build out 2nd level navigation.在他们自己的子路由器中拥有产品视图的子视图(飞机、炸弹等)可以让您轻松构建第二级导航。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM