skipLocationChange 不能正常工作
skipLocationChange not working perfectly
我正在使用 skipLocationChange 在 3 个地图组件之间导航:Cesium、Leaflet 和 Openlayers 3。我的应用程序正在保留组件之间的位置,如您在 mapmip.webiks.com(旧版本)中所见。
为了在从组件移动到其他组件时设置边界,我订阅了以下功能:
setQueryBoundsOnNavigationEnd(event:NavigationEnd):void {
let urlTree:UrlTree = this.leaflet.router.parseUrl(event.url);
urlTree.queryParams['bounds'] = this.getBounds().toString();
extras.skipLocationChange = this.skipLocationChange;
return this.router.navigateByUrl(url, extras);
}
这样
leaflet.router.events.filter(event => event instanceof NavigationEnd && event.url.includes("/cesium")).take(1).subscribe(this.setQueryBoundsOnNavigationEnd.bind(this));
但是当我从铯中回来时 - url 不再隐藏了。
提前致谢!
我缺少 unsubsribe(),因此出现 NavigationError 并且状态未正确加载
我正在使用 skipLocationChange 在 3 个地图组件之间导航:Cesium、Leaflet 和 Openlayers 3。我的应用程序正在保留组件之间的位置,如您在 mapmip.webiks.com(旧版本)中所见。 为了在从组件移动到其他组件时设置边界,我订阅了以下功能:
setQueryBoundsOnNavigationEnd(event:NavigationEnd):void {
let urlTree:UrlTree = this.leaflet.router.parseUrl(event.url);
urlTree.queryParams['bounds'] = this.getBounds().toString();
extras.skipLocationChange = this.skipLocationChange;
return this.router.navigateByUrl(url, extras);
}
这样
leaflet.router.events.filter(event => event instanceof NavigationEnd && event.url.includes("/cesium")).take(1).subscribe(this.setQueryBoundsOnNavigationEnd.bind(this));
但是当我从铯中回来时 - url 不再隐藏了。
提前致谢!
我缺少 unsubsribe(),因此出现 NavigationError 并且状态未正确加载