[英]Aurelia Child Sub Router
So I have an issue where my sub router is not working when I throw it in a template. 所以我有一个问题,当我将其放置在模板中时,我的子路由器无法工作。 Here is what I mean:
这是我的意思:
My app.js has this route which works: 我的app.js可以使用以下路由:
{
route: ['accounts'],
name: 'accounts',
moduleId: '../accounts/account-router',
nav: false,
title: 'QualBoard',
},
In accounts-router I have (which works): 在帐户路由器中,我有(有效):
export class AccountRouter {
configureRouter(config) {
config.map([
{
route: [':accountId'],
name: 'account',
moduleId: './account',
nav: false,
title: 'QualBoard',
},
{
route: [':id/users'],
name: 'users',
moduleId: '../users/users-router',
nav: false,
title: 'QualBoard',
},
]);
}
}
Inside of account.html I have a template call to another route : 在account.html内部,我有一个到另一条路线的模板调用:
<template>
<require from="./account-overview.html"></require>
<require from="./sub-view/subview-router"></require>
<div class="content-panel">
<account-overview account.bind="account"></account-overview>
<subview-router></subview-router>
</div>
</template>
So the subview router looks like so: 因此,子视图路由器如下所示:
export class SubviewRouter {
configureRouter(config, router) {
config.map([
{
route: ['projects', ''],
name: 'projects',
moduleId: './projects',
nav: true,
title: 'Projects',
settings: {
class: 'icon-ion-briefcase',
},
},
]);
this.router = router;
}
}
And the subview-router.html: 和subview-router.html:
<template>
<router-view containerless></router-view>
</template>
All the routes work but the final subview router. 除了最终的子视图路由器之外,所有路由都有效。 Oddly I can take the code in subview router and add it into my account.js file as well as swap out with and it will work.
奇怪的是,我可以将代码放入subview路由器中,并将其添加到我的account.js文件中,并与之交换出来,它将起作用。 Why is the subview router not working?
为什么子视图路由器不起作用?
尝试将您的nav:false更改为nav:true。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.