填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

RouteReuseStrategy

提供一种自定义复用已激活路由的方式。

Provides a way to customize when activated routes get reused.

      
      abstract class RouteReuseStrategy {
  abstract shouldDetach(route: ActivatedRouteSnapshot): boolean
  abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void
  abstract shouldAttach(route: ActivatedRouteSnapshot): boolean
  abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null
  abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean
}
    

方法

确定是否应分离此路由(及其子树)以便以后复用

Determines if this route (and its subtree) should be detached to be reused later

      
      abstract shouldDetach(route: ActivatedRouteSnapshot): boolean
    
参数
route ActivatedRouteSnapshot
返回值

boolean

存储分离的路由。

Stores the detached route.

      
      abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void
    
参数
route ActivatedRouteSnapshot
handle DetachedRouteHandle
返回值

void

存储 null 值应清除先前存储的值。

Storing a null value should erase the previously stored value.

确定是否应重新连接此路由(及其子树)

Determines if this route (and its subtree) should be reattached

      
      abstract shouldAttach(route: ActivatedRouteSnapshot): boolean
    
参数
route ActivatedRouteSnapshot
返回值

boolean

检索以前存储的路由

Retrieves the previously stored route

      
      abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null
    
参数
route ActivatedRouteSnapshot
返回值

DetachedRouteHandle | null

确定是否应复用路由

Determines if a route should be reused

      
      abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean
    
参数
future ActivatedRouteSnapshot
curr ActivatedRouteSnapshot
返回值

boolean