角度 RouteReuseStrategy 滚动位置错误。
当我从另一个页面返回列表页面时,滚动条回到顶部
import {ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy} from '@angular/router';
export class SystemRouteReuseStrategy implements RouteReuseStrategy {
handlers: {[key: string]: DetachedRouteHandle} = {};
shouldDetach(route: ActivatedRouteSnapshot): boolean {
if (route.data.reuse) {
return true;
}
return false;
}
store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void {
this.handlers[route.routeConfig.path] = handle;
}
shouldAttach(route: ActivatedRouteSnapshot): boolean {
return !!route.routeConfig && !!this.handlers[route.routeConfig.path];
}
retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle {
return this.handlers[route.routeConfig.path];
}
shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
return future.routeConfig === curr.routeConfig;
}
}
Run Code Online (Sandbox Code Playgroud) 这个超级DAO:
public class CrudDAO{
}
Run Code Online (Sandbox Code Playgroud)
这个孩子班:
@Repository
public class JnsTimeDao extends CrudDAO {
}
@Repository
public class BatchDAO extends CrudDAO {
}
Run Code Online (Sandbox Code Playgroud)
这个超级服务类
@Transactional(readOnly = true)
public abstract class CrudService<D extends CrudDAO> {
@Autowired
protected D dao;
}
Run Code Online (Sandbox Code Playgroud)
启动错误:
org.springframework.beans.factory.NoUniqueBeanDefinitionException:没有定义[com.gp.dao.CrudDAO]类型的限定bean:期望的单个匹配bean但找到2:batchDAO,jnsTimeDao