• 需求一:进入到 news 这个一级路由组件当中,要同事把 /news/company 和 /news/introduce 同时展示出来
    • 需求二:将子级路由组件显示到不同的路由插座中
      1. // 使用 outlet 属性
      2. {
      3. path: "news",
      4. component: NewsComponent,
      5. children: [
      6. {
      7. path: "company",
      8. component: CompanyComponent,
      9. outlet: "left"
      10. },
      11. {
      12. path: "introduce",
      13. component: IntroduceComponent,
      14. outlet: "right"
      15. },
      16. ]
      17. },
      1. // 定义路由命名插槽
      2. <router-outlet name="left"></router-outlet>
      3. <router-outlet name="right"></router-outlet>
      1. <a [routerLink]="['/news', { outlets: { left: ['company'], right: ['introduce'] } }]">新闻</a>