我正在尝试将 htmlview(根据 SAP 的文档使用声明性支持)添加到也使用声明性支持的索引页面。使用 data-sap-ui-type="ui.MyView" 让我问两个问题:
- 在声明性支持中是否有与 sap.ui.localResources 等效的内容?
- data-ui-type 未将 view.html 后缀添加到应加载的视图中。在声明性支持中是否有 MVC 的特殊模式,或者目前没有办法实现它?
亲切的问候,尼科
我正在尝试将 htmlview(根据 SAP 的文档使用声明性支持)添加到也使用声明性支持的索引页面。使用 data-sap-ui-type="ui.MyView" 让我问两个问题:
亲切的问候,尼科
在这里找到一些基本示例: https ://openui5.hana.ondemand.com/#docs/guide/MVC.html
首先,我相信您始终必须sap.ui.localResources
在代码中进行设置。
如您所见,从 HTMLView 实例化 HTMLView 如下所示:
<div data-sap-ui-type="sap.ui.core.mvc.HTMLView" id="MyHTMLView" data-view-name="example.mvc.test2"></div>
这将加载example.mvc.test2.view.html
并将其放置到您的父视图中。
一般来说,JS API 会像这样转换成 HTMLView:
new sap.ui.AnyControl("myId", {
aLittleProperty: "10",
property: false,
press: functionInMyController,
morePress: a.static.myFunction,
defaultAggregation: [
new sap.ui.OtherControl("otherId1"),
new sap.ui.OtherControl("otherId2")
],
anotherAggregation: new sap.ui.OtherControl("otherId3")
}).addStyleClass("myClass");
<div data-sap-ui-type="sap.ui.AnyControl"
id="myId"
class="myClass"
data-a-little-property="10",
data-property="false"
data-press="functionInMyController"
data-more-press="a.static.myFunction">
<div data-sap-ui-type="sap.ui.OtherControl" id="otherId1"></div>
<div data-sap-ui-type="sap.ui.OtherControl" id="otherId2"></div>
<div data-sap-ui-aggregation="anotherAggregation">
<div data-sap-ui-type="sap.ui.OtherControl" id="otherId3"></div>
</div>
</div>
注意:
克里斯