SAP UI5 walkthrough step3 Controls

在上一步,我们是直接用index.html 中的body 里面的DIVision去输出 hello world,

在这个章节,我们将用SAP UI5 的标准控件 sap/m/Text

首先,我们去修改 webapp/index.html

html 复制代码
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>UI5 Walkthrough</title>
	<script
		id="sap-ui-bootstrap"
		src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
		data-sap-ui-theme="sap_horizon"
		data-sap-ui-libs="sap.m"
		data-sap-ui-compatVersion="edge"
		data-sap-ui-async="true"
		data-sap-ui-onInit="module:ui5/walkthrough/index"
		data-sap-ui-resourceroots='{
			"ui5.walkthrough": "./"
		}'>

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

index.html 这个文件中指明了,我们要先去加载index.js 文件

所以我们在index.js 中需要去实例化 content

webapp/index.js

html 复制代码
sap.ui.define([
	"sap/m/Text"
], (Text) => {
	"use strict";

	new Text({
		text: "Hello World"
	}).placeAt("content");
});

Instead of using native JavaScript to display a dialog we want to use a simple SAPUI5 control. Controls are used to define appearance and behavior of parts of the screen.

In the example above, the callback of the init event is where we now instantiate a SAPUI5 text control. The name of the control is prefixed by the namespace of its control library sap/m/ and the options are passed to the constructor with a JavaScript object. For our control we set the text property to the value "Hello World".

We chain the constructor call of the control to the standard method placeAt that is used to place SAPUI5 controls inside a node of the document object model (DOM) or any other SAPUI5 control instance. We pass the ID of a DOM node as an argument. As the target node we use the body tag of the HTML document and give it the ID content.

All controls of SAPUI5 have a fixed set of properties, aggregations, and associations for configuration. You can find their descriptions in the Demo Kit. In addition, each control comes with a set of public functions that you can look up in the API reference.

最后的实现效果就是:

相关推荐
sinat_375112263 天前
abap 通用发送邮件程序(获取alv数据,带excel附件)
excel·sap·abap·邮件
大路谈数字化7 天前
SAP 物料凭证和会计凭证的关联关系
sap·物料凭证·会计凭证
企业数字化建设者9 天前
SAP_MM_供应商寄售 ( Vendor Consignment ) 实施流程
sap·mm
放弃幻想_10 天前
S4和ECC或者不通CLIENT,不通HANA服务器互相取数
服务器·数据库·sap·abap·abap sap
爱喝水的鱼丶16 天前
SAP-ABAP:SAP中的用户确认对话框:深入理解与实践POPUP_TO_CONFIRM
运维·开发语言·学习·sap·abap
handsome123423 天前
SAP杂记
sap·rfc·se16
1314lay_10071 个月前
使用HTTP接口,对接外围系统,封装调用跟推送类和动态转换json,动态编程和动态调用函数
http·json·abap
爱喝水的鱼丶2 个月前
SAP-MM:SAP采购组织全面学习指南:从概念到实战配置图解
运维·开发语言·数据库·学习·sap·mm模块·采购组织
爱喝水的鱼丶2 个月前
SAP-MM:SAP核心组织单元:工厂(Plant)全面学习指南及配置图解
学习·sap·abap·配置·工厂·mm模块
爱喝水的鱼丶2 个月前
SAP-ABAP: ABAP ASSIGN COMPONENT 语句详解:动态字段符号的利器作用用法示例详解
运维·开发语言·sap·abap·开发经验·动态字段符号