填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫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