【问题标题】:SAPUI5 reuse Views and make new instanceSAPUI5 重用视图并创建新实例
【发布时间】:2017-07-10 07:43:00
【问题描述】:

我是 SAP 的新手,正在尝试开发 SAPUI5 应用程序,但在重用视图/部分视图时遇到了一些问题。我想要一个局部视图并以特定格式传递自定义数据(数据更改但模型相同),并在一页中多次重用这些局部视图,每次传递不同的数据。不知何故像瓷砖,但非常定制化。 你建议我用什么? 我已尝试创建常规视图的新实例,但遇到此错误:

获取https://sapui5.hana.ondemand.com/resources/view/List.view.xml404 (未找到)

这是我创建新实例的代码:

var firstListView=sap.ui.xmlview("firstViw", "view.List");

感谢您的帮助

更新: 这是我的 index.html

    <!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv='Content-Type' content='text/html;charset=UTF-8' />

    <script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
            id="sap-ui-bootstrap"
            data-sap-ui-libs="sap.m, sap.ushell"
            data-sap-ui-xx-bindingSyntax="complex"
            data-sap-ui-theme="sap_belize"
            data-sap-ui-resourceroots='{
            "sap.ui.appName": "./"
        }'>
    </script>
    <script src="../libs/jquery.cookie.js"></script>

    <link href="css/site.css" rel="stylesheet" type="text/css" />
    <link href="css/library.css" rel="stylesheet" type="text/css" />
     <link href="css/theme/library.css" rel="stylesheet" type="text/css" />
    <script>

        sap.ui.getCore().attachInit(function () {
            new sap.m.Shell({
                appWidthLimited:false,
                app: new sap.ui.core.ComponentContainer({
                    name: "sap.ui.appName"
                })
            }).placeAt("content");
        });


    </script>
</head>
<body class="sapUiBody" role="application">
    <div id="content"></div>
</body>
</html>

这是结构化的文件夹:

【问题讨论】:

  • 关于错误:index.html 中resourceRoots 定义的命名空间是什么?您的项目文件夹是如何构成的?如果您可以相应地更新问题,那就太好了。
  • 感谢您的回答,我已经更新了这个问题。 @boghyon

标签: model-view-controller view sapui5 sap-fiori


【解决方案1】:

请查看 UI5 SDK 的“重用 UI 部件:片段”一章。 这是一个摘录。请看看这是否有帮助。

【讨论】:

  • 感谢您的回答。所以你建议在这种情况下使用片段?
  • Walkthrough(步骤 15-17)通过将对话实例化为片段很好地解释了这一点。
猜你喜欢
  • 2019-07-15
  • 2023-03-25
  • 1970-01-01
  • 2017-12-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多