Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
aurelia中父/子路由器的活动类句柄_Aurelia - Fatal编程技术网

aurelia中父/子路由器的活动类句柄

aurelia中父/子路由器的活动类句柄,aurelia,Aurelia,我对aurelia是新来的,我在左侧有一个主菜单,其中一个菜单(邮件)有子菜单(收件箱、已发送、垃圾箱)。如果子菜单处于活动状态(#当前URL、#活动类、#CSS)需要为父菜单(邮件)保留活动类,则需要执行此操作。 app.js 导出类应用程序{ configureRouter(config, router){ config.title = 'DMS'; config.map([ { route: ['dashboard',''], name: 'Dashbo

我对aurelia是新来的,我在左侧有一个主菜单,其中一个菜单(邮件)有子菜单(收件箱、已发送、垃圾箱)。如果子菜单处于活动状态(#当前URL、#活动类、#CSS)需要为父菜单(邮件)保留活动类,则需要执行此操作。 app.js

导出类应用程序{

configureRouter(config, router){
    config.title = 'DMS';

    config.map([
        { route: ['dashboard',''],  name: 'Dashboard',
            moduleId: './templates/dashboard/dashboard',  nav: true, title:'Dashboard',settings:{'img' : 'ic-dashboard.png'} },
        { route: ['settings'],  name: 'Settings',
            moduleId: './templates/settings/settings',  nav: true, title:'Settings' ,settings:{'icon' : 'settings'} },
        { route: ['inbox'],  name: 'inbox',
            moduleId: './templates/mail/inbox/inbox',  nav: true, title:'Mail' ,settings:{'img' : 'mail.png'} },
        { route: ['inbox/trash'],  name: 'trash',
            moduleId: './templates/mail/trash/trash', title:'Mail' },
        { route: ['inbox/sent'],  name: 'sent',
            moduleId: './templates/mail/sent/sent', title:'Mail'},
    ]);

    this.router = router;
}
}
菜单列表也应用活动类

<div class="row col s12 ${row.isActive ? 'active' : ''}" repeat.for = "row of router.navigation" >
        <a href.bind = "row.href">
        <div class="col s2 " >
            <div if.bind="row.settings.img">
                <img src="src/assets/${row.settings.img}">
            </div>
            <div if.bind="row.settings.icon">
                <i class="tiny material-icons">${row.settings.icon}</i>
            </div>
        </div>
        </a>
    </div>

子菜单url

  <div class="col s8 offset-s2 mail_actionLst">
                    <ul>
                        <li class="inbox mail_active"><a href="#/inbox"> Inbox &nbsp; <span>(43)</span></a> </li>
                        <li class="sent"><a href="#/inbox/sent">Sent</a> </li>
                        <li class="trash"><a href="#/inbox/trash">Trash</a></li>
                    </ul>
                </div>


如何将父类设置为活动。

因为这些是不同的路由,而不是父类+子类。 您应该在父类中描述子路由。 您可以向inbox.js添加代码:

configureRouter(配置,路由器){
config.map([
{路由:['trash'],名称:'trash',
moduleId:“路径到垃圾桶”,标题:'Mail'},
{路由:['sent'],名称:'sent',
moduleId:'发送路径',标题:'邮件'},
]);
this.router=路由器;
}
别忘了加上

发送到inbox.html

,因为这些是不同的路由,而不是父级+子级。 您应该在父类中描述子路由。 您可以向inbox.js添加代码:

configureRouter(配置,路由器){
config.map([
{路由:['trash'],名称:'trash',
moduleId:“路径到垃圾桶”,标题:'Mail'},
{路由:['sent'],名称:'sent',
moduleId:'发送路径',标题:'邮件'},
]);
this.router=路由器;
}
别忘了加上
inbox.html