🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## RouterOutlet 相当于一个占位符,在Angular中根据路由状态动态插入视图。 ### 如何使用 ```html <router-outlet></router-outlet> <router-outlet name='left'></router-outlet> <router-outlet name='right'></router-outlet> ``` 一个路由插座可以在任何时候组件实例化时发出一个`activate`消息,并且在组件销毁时发出一个`deactivate`消息。 ```html <router-outlet (activate)="onActivate($event)" (deactivate)="onDeactivate($event)"></route-outlet> ``` ### 类定义 ```typescript class RouterOutlet { constructor(parentOutletMap: RouterOutletMap, location: ViewContainerRef, resolver: ComponentFactoryResolver, name: string) outletMap : RouterOutletMap activateEvents : EventEmitter deactivateEvents : EventEmitter ngOnDestroy() : void isActivated : boolean component : Object activatedRoute : ActivatedRoute deactivate() : void activate(activatedRoute: ActivatedRoute, loadedResolver: ComponentFactoryResolver, loadedInjector: Injector, providers: ResolvedReflectiveProvider[], outletMap: RouterOutletMap) : void } ``` ### 属性 - outletMap : `RouterOutletMap` - activateEvents : `EventEmitter` - deactivateEvents : `EventEmitter` - ngOnDestroy() : `void` - isActivated : `boolean` - component : `Object` - activateRoute : `ActivateRoutes` - deactivate() : `void` - activate(activatedRoute: `ActivatedRoute`, loadedResolver: `ComponentFactoryResolver`, loadedInjector: `Injector`, providers: `ResolvedReflectiveProvider[]`, outletMap: `RouterOutletMap`) : `void`