BaseRouteReuseStrategy
此基本路由复用策略仅在匹配的路由器配置完全相同时复用路由。这样可以防止仅在片段或查询参数发生更改时销毁和重新创建组件(也就是复用现有组件)。
This base route reuse strategy only reuses routes when the matched router configs are identical. This prevents components from being destroyed and recreated when just the fragment or query parameters change (that is, the existing component is reused).
abstract class BaseRouteReuseStrategy implements RouteReuseStrategy {
shouldDetach(route: ActivatedRouteSnapshot): boolean
store(route: ActivatedRouteSnapshot, detachedTree: DetachedRouteHandle): void
shouldAttach(route: ActivatedRouteSnapshot): boolean
retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null
shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean
}
说明
此策略不存储任何路由供以后复用。
This strategy does not store any routes for later reuse.
Angular 默认使用此策略。
Angular uses this strategy by default.
它可以用作自定义路由复用策略的基类,即,你可以创建自己的类来扩展 BaseRouteReuseStrategy
。
It can be used as a base class for custom route reuse strategies, i.e. you can create your own class that extends the BaseRouteReuseStrategy
one.
方法
给定的路由是否应该分离以便以后复用。 Whether the given route should detach for later reuse. Always returns false for |
无操作;永远不会存储该路由,因为此策略永远不会分离路由以供以后复用。 A no-op; the route is never stored since this strategy never detaches routes for later re-use. | ||||||
参数
返回值
|
返回 Returns |
返回 Returns | |||
参数
返回值
|
确定是否应复用路由。当将来的路由配置和当前的路由配置相同时,此策略将返回 Determines if a route should be reused. This strategy returns | ||||||
参数
返回值
|