使用Aurelia,如何使用route-href引用子路由?

Using Aurelia, how to use route-href to reference child routes?

使用Aurelia,如何使用route-href构造引用子路由的锚标记href?

在 app.js 中,定义到父视图的路由。

config.map([
{ 
   route: 'parentview,
   name: 'parentview',
   moduleId: './parentview'
}]);

在parentview.js中,配置到子视图的路由:

config.map([
{ 
   route: ['', 'childviewone'], name: 'childviewone', moduleId: './childviewone' },
   route:      'childviewtwo',  name: 'childviewtwo', moduleId: './childviewtwo' }
]);

我没有找到使用 route-href 来构建看起来像 "parentview/childviewone" 或 "parentview/childviewtwo".

的锚标记 href 的方法

这似乎是一个简单且可能很常见的场景。也许以下问题阻碍了?或者我错过了什么?

https://github.com/aurelia/router/issues/89

https://github.com/aurelia/router/issues/90

我认为 aurelia-router 目前不支持从父路由器生成到子路由器的 URL。路由器配置当前是延迟加载的,因此在显示具有路由配置的组件之前,子路由的路由是未知的。您可以生成到父路由或同一范围内的路由的路由,但不能从另一个子路由或根路由到子路由。