欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

SAP Spartacus的navigation初始化

发布时间:2023/12/19 编程问答 41 豆豆
生活随笔 收集整理的这篇文章主要介绍了 SAP Spartacus的navigation初始化 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

SAP Spartacus navigation入口:

/*** Sets up the location change listener and performs the initial navigation.*/initialNavigation() {this.setUpLocationChangeListener();if (this.navigationId === 0) {this.navigateByUrl(this.location.path(true), { replaceUrl: true });}} /*** Navigates to a view using an absolute route path.** @param url An absolute path for a defined route. The function does not apply any delta to the* current URL.* @param extras An object containing properties that modify the navigation strategy.* The function ignores any properties in the `NavigationExtras` that would change the* provided URL.** @returns A Promise that resolves to 'true' when navigation succeeds,* to 'false' when navigation fails, or is rejected on error.** @usageNotes** The following calls request navigation to an absolute path.** ```* router.navigateByUrl("/team/33/user/11");** // Navigate without updating the URL* router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });* ```** @see [Routing and Navigation guide](guide/router)**/navigateByUrl(url, extras = { skipLocationChange: false }) {if (isDevMode() && this.isNgZoneEnabled && !NgZone.isInAngularZone()) {this.console.warn(`Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'?`);}const urlTree = isUrlTree(url) ? url : this.parseUrl(url);const mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree);return this.scheduleNavigation(mergedTree, 'imperative', null, extras);}



RouterStateSnapshot的url字段里包含的electronics-spa/en/USD是怎么来的?

ActivatedRouteSnapshot

array是一个闭包:

此时还没有从后台请求数据,前台怎么知道url应该为electronics-spa/en/USD?

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

总结

以上是生活随笔为你收集整理的SAP Spartacus的navigation初始化的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。