Javascript 具有标准SAPUI5路由的sap.ui.unified.Shell
我们试图通过使用标准路由概念在sap.ui.unified.shell内容中实现多个视图,但我们不知道如何在代码级别实现这一点 当用户单击侧窗格中的主项时,主视图应加载到shell内容中。(主视图应为书签url) MAIN.VIEW.XML:Javascript 具有标准SAPUI5路由的sap.ui.unified.Shell,javascript,sapui5,sap-fiori,Javascript,Sapui5,Sap Fiori,我们试图通过使用标准路由概念在sap.ui.unified.shell内容中实现多个视图,但我们不知道如何在代码级别实现这一点 当用户单击侧窗格中的主项时,主视图应加载到shell内容中。(主视图应为书签url) MAIN.VIEW.XML: <mvc:View xmlns:l="sap.ui.layout" xmlns:u="sap.ui.unified" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" class="viewPadding">
<mvc:View
xmlns:l="sap.ui.layout"
xmlns:u="sap.ui.unified"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
class="viewPadding">
<u:Shell
id="myShell">
<u:headItems>
<u:ShellHeadItem
tooltip="Configuration"
icon="sap-icon://menu2"
press="handlePressConfiguration" />
<u:ShellHeadItem
tooltip="Home"
icon="sap-icon://home"
visible="false"
press="" />
</u:headItems>
<u:headEndItems>
<u:ShellHeadItem
icon="sap-icon://log"
tooltip="Logoff"
press="" />
</u:headEndItems>
<u:user>
<u:ShellHeadUserItem
image="sap-icon://person-placeholder"
username="Test User"
press="" />
</u:user>
<u:search>
<SearchField
search="handleSearchPressed"/>
</u:search>
<u:paneContent>
<List>
<DisplayListItem
label="Home"
type="Navigation" />
<DisplayListItem
label="Page 1"
type="Navigation" />
<DisplayListItem
label="Page 2"
type="Navigation"/>
<DisplayListItem
label="Page 3"
type="Navigation"/>
</List>
</u:paneContent>
</u:Shell>
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="shellproject.page1" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Title">
<content>
<Text text=" Page 1 Contents Here.."/>
</content>
</Page>
类似地,当用户选择任何侧菜单项时,相应的视图应加载到shell的内容中
Page1.view.xml应加载到shell内容中。(Page1视图应为书签url)
PAGE1.VIEW.XML:
<mvc:View
xmlns:l="sap.ui.layout"
xmlns:u="sap.ui.unified"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
class="viewPadding">
<u:Shell
id="myShell">
<u:headItems>
<u:ShellHeadItem
tooltip="Configuration"
icon="sap-icon://menu2"
press="handlePressConfiguration" />
<u:ShellHeadItem
tooltip="Home"
icon="sap-icon://home"
visible="false"
press="" />
</u:headItems>
<u:headEndItems>
<u:ShellHeadItem
icon="sap-icon://log"
tooltip="Logoff"
press="" />
</u:headEndItems>
<u:user>
<u:ShellHeadUserItem
image="sap-icon://person-placeholder"
username="Test User"
press="" />
</u:user>
<u:search>
<SearchField
search="handleSearchPressed"/>
</u:search>
<u:paneContent>
<List>
<DisplayListItem
label="Home"
type="Navigation" />
<DisplayListItem
label="Page 1"
type="Navigation" />
<DisplayListItem
label="Page 2"
type="Navigation"/>
<DisplayListItem
label="Page 3"
type="Navigation"/>
</List>
</u:paneContent>
</u:Shell>
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="shellproject.page1" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Title">
<content>
<Text text=" Page 1 Contents Here.."/>
</content>
</Page>
Page2.view.xml应加载到shell内容中。(Page2视图应为书签url)
PAGE2.VIEW.XML
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="shellproject.page2" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Title">
<content>
<Text text=" Page 2 Contents Here.."/>
</content>
</Page>
如果需要更多详细信息,我将分享我的样本sapui5代码以供参考。请添加样本code@deterministicFail,我在这里实现的示例sapui5代码。您定义了路由器吗?你不必自己编程,你需要这样的配置:{routerClass:“com.namespace.yourRouter”,viewType:“XML”,viewPath:“com.namespace.views”,controlId:“myShell”,controlAggregation:“content”,clearTarget:true}如果我实现路由器配置。是否可以在shell内容中动态加载页面视图。如果可能的话,你可以请任何这样的示例实现。谢谢