解决方法:
在app-routing.cache.ts中增加对子的判断
public
static handlers: { [key:
string]:
DetachedRouteHandle } = {};
// 表示对路由允许复用
public
shouldDetach(route:
ActivatedRouteSnapshot):
boolean {
// 默认对所有路由复用 可通过给路由配置项增加data: { keep: true }来进行选择性使用,代码如下
if (!route.routeConfig
|| route.routeConfig.loadChildren) {
return false;
}
return true;
}
来自 https://blog.csdn.net/qq_36279445/article/details/79282509