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.

最后的实现效果就是:

相关推荐
Seele_10183 天前
RAP - 报表示例
sap·abap
SAP_奥维奥科技3 天前
破局传统制造,赋能智能转型——机加工企业智能工厂升级实施方案重磅出炉
sap·智能制造·sap管理系统·sap管理系统软件·sap实施服务商推荐
SAP_奥维奥科技4 天前
如何选择适合自己企业的SAP实施服务商?
sap
SAP_奥维奥科技5 天前
详解SAP Business One:信用额度管理
sap·sap管理系统·sap business one·sap管理系统软件·sap实施服务商
爱喝水的鱼丶6 天前
SAP-ABAP:高效开发指南:全局唯一标识符ICF_CREATE_GUID函数的全面解析与实践
运维·服务器·开发语言·数据库·sap·abap·开发交流
LilySesy6 天前
【SAP-MOM项目】二、接口对接(中)
开发语言·python·pandas·restful·sap·abap
Lisson 37 天前
VF01修改实际开票数量增强
java·服务器·前端·abap
Henry-SAP8 天前
SAP(ERP) 组织结构业务视角解析
大数据·人工智能·sap·erp·sap pp
爱喝水的鱼丶10 天前
SAP-ABAP:掌握BAPI_OUTB_DELIVERY_CONFIRM_DEC:解锁SAP自动化发货的核心钥匙
运维·学习·sap·abap·交流学习
SAP_奥维奥科技11 天前
详解SAP Business One:采购费用的处理方式
sap