简体   繁体   English

如何从启动板导航到 Fiori 应用程序然后返回?

[英]How to navigate from launchpad to Fiori apps and then back?

In our company, we've set up the Fiori launchpad, in it we have configured a tile that is linked to a customly developed SAPUI5 app, which is deployed as a BSP on the server.在我们公司,我们设置了 Fiori 启动板,我们在其中配置了一个磁贴,该磁贴链接到自定义开发的 SAPUI5 应用程序,该应用程序作为 BSP 部署在服务器上。 It took us a long while, yet using the router pattern within that application, we managed to make the navigation from the Launchpad tile to the custom UI5 application work.我们花了很长时间,但在该应用程序中使用路由器模式,我们设法使从 Launchpad 磁贴到自定义 UI5 应用程序的导航正常工作。

The thing we are struggling with, however, are these 2 other navigation paths:然而,我们正在努力解决的问题是另外两条导航路径:

  • From the application back to the Fiori launchpad (back home)从应用程序返回到 Fiori 启动板(回到主页)
  • From the application to another application (tile to tile)从应用程序到另一个应用程序(平铺到平铺)

Ideally, this out of application navigation is in the UI5 way, including a transition, so not just a window.replace in JS.理想情况下,这种应用程序外导航采用 UI5 方式,包括过渡,因此不仅仅是 JS 中的 window.replace。 After a long search, the only hint I've found in support for this scenario is in this class:经过长时间的搜索,我发现支持这种情况的唯一提示是在这个类中:

https://sapui5.hana.ondemand.com/sdk/#docs/api/symbols/sap.ushell.services.CrossApplicationNavigation.html https://sapui5.hana.ondemand.com/sdk/#docs/api/symbols/sap.ushell.services.CrossApplicationNavigation.html

However, I don't understand how to use it.但是,我不明白如何使用它。 The example isn't even correct and has syntax errors.该示例甚至不正确并且存在语法错误。 I've found 2 forum posts elsewhere asking about how to use it, but they lack any meaningful answer.我在其他地方找到了 2 个论坛帖子,询问如何使用它,但它们缺乏任何有意义的答案。

Assuming you are using Semantic Objects for in-place navigation configured in your Launchpad to navigate to UI5 Applications you can navigate from one Application to another using the CrossApplicationNavigation service you already mentioned.假设您使用Semantic Objects进行在 Launchpad 中配置的就地导航以导航到 UI5 应用程序,您可以使用您已经提到的CrossApplicationNavigation服务从一个应用程序导航到另一个应用程序。 However, the documentation about it is slightly confusing.但是,关于它的文档有点令人困惑。 This is how it works for me:这对我来说是这样的:

// Step 1: Get Service for app to app navigation
var navigationService = sap.ushell.Container.getService("CrossApplicationNavigation");

// Step 2: Navigate using your semantic object
navigationService.toExternal({ 
                               target : { semanticObject : "<YourObject>", action: "<YourAction>" },
                               params : { A : "B" } // optionally
                            })

If you want to go back to your launchpad after in-place navigation you simply need to call如果您想在就地导航后返回启动板,您只需调用

window.history.go(-1)

This still triggers the correct transition.这仍然会触发正确的转换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM