SAP UI5 walkthrough step10 Descriptor for Applications

news/2024/11/16 16:17:44/

在这一步,我们将会把所有的应用相关的描述性的文件独立放到manifest.json

新建一个manifest.json文件

webapp/manifest.json (New)

{"_version": "1.58.0","sap.app": {"id": "ui5.walkthrough","i18n": "i18n/i18n.properties","title": "{{appTitle}}","description": "{{appDescription}}","type": "application","applicationVersion": {"version": "1.0.0"}},"sap.ui": {"technology": "UI5","deviceTypes": {"desktop": true,"tablet": true,"phone": true}},"sap.ui5": {"dependencies": {"minUI5Version": "1.108.0","libs": {"sap.ui.core": {},"sap.m": {}}},"models": {"i18n": {"type": "sap.ui.model.resource.ResourceModel","settings": {"bundleName": "ui5.walkthrough.i18n.i18n","supportedLocales": [""],"fallbackLocale": ""}}},"rootView": {"viewName": "ui5.walkthrough.view.App","type": "XML","id": "app"}}
}
  • The sap.app namespace contains the following application-specific attributes:

    • id (mandatory): The namespace of our application component.

      The ID must not exceed 70 characters. It must be unique and must correspond to the component ID/namespace.

    • type: Defines what we want to configure; here: an application.

    • i18n: Defines the path to the resource bundle file. The supportedLocales and fallbackLocale properties are set to empty strings, as our demo app uses only one i18n.properties file for simplicity and we'd like to prevent the browser from trying to load additional i18n_*.properties files based on your browser settings and your locale.

    • title: Title of the application in handlebars syntax referenced from the app's resource bundle.

    • description: Short description text what the application does in handlebars syntax referenced from the app's resource bundle.

    • applicationVersion: The version of the application to be able to update the application easily later on.

  • sap.ui

    The sap.ui namespace contributes the following UI-specific attributes:

    • technology: This value specifies the UI technology; in our case we use SAPUI5

    • deviceTypes: Tells what devices are supported by the app: desktop, tablet, phone (all true by default)

  • sap.ui5

    The sap.ui5 namespace adds SAPUI5-specific configuration parameters that are automatically processed by SAPUI5. The most important parameters are:

    • rootView: If you specify this parameter, the component will automatically instantiate the view and use it as the root for this component

    • dependencies: Here we declare the UI libraries used in the application

    • models: In this section of the descriptor we can define models that will be automatically instantiated by SAPUI5 when the app starts. Here we can now define the local resource bundle. We define the name of the model "i18n" as key and specify the bundle file by namespace. As in the previous steps, the file with our translated texts is stored in the i18n folder and named i18n.properties. We simply prefix the path to the file with the namespace of our app. The manual instantiation in the app component's init method will be removed later in this step. The supportedLocales and fallbackLocale properties are set to empty strings, as in this tutorial our demo app uses only one i18n.properties file for simplicity, and we'd like to prevent the browser from trying to load additional i18n_*.properties files based on your browser settings and your locale.

    For compatibility reasons the root object and each of the sections state the descriptor version number 1.58.0 under the internal property _version. Features might be added or changed in future versions of the descriptor and the version number helps to identify the application settings by tools that read the descriptor.

修改index.html

<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>UI5 Walkthrough</title><scriptid="sap-ui-bootstrap"src="resources/sap-ui-core.js"data-sap-ui-theme="sap_horizon"data-sap-ui-compatVersion="edge"data-sap-ui-async="true"data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"data-sap-ui-resourceroots='{"ui5.walkthrough": "./"}'></script>
</head>
<body class="sapUiBody" id="content"><div data-sap-ui-component data-name="ui5.walkthrough" data-id="container" data-settings='{"id" : "walkthrough"}'></div>
</body>
</html>

修改i18n

webapp/i18n/i18n.properties

# App Descriptor
appTitle=Hello World
appDescription=A simple walkthrough app that explains the most important concepts of SAPUI5# Hello Panel
showHelloButtonText=Say Hello
helloMsg=Hello {0}

修改component 

webapp/Component.js

sap.ui.define(["sap/ui/core/UIComponent","sap/ui/model/json/JSONModel"
], (UIComponent, JSONModel) => {"use strict";return UIComponent.extend("ui5.walkthrough.Component", {metadata : {interfaces: ["sap.ui.core.IAsyncContentCreation"],manifest: "json"},init() {// call the init function of the parentUIComponent.prototype.init.apply(this, arguments);// set data modelconst oData = {recipient : {name : "World"}};const oModel = new JSONModel(oData);this.setModel(oModel);}});
});

Conventions

  • The descriptor file is named manifest.json and located in the webapp folder.

  • Use translatable strings for the title and the description of the app.


http://www.ppmy.cn/news/1263349.html

相关文章

【MySQL】:库的操作

库的操作 一.创建和删除数据库二.认识编码三.库的查改1.查找2.修改 四.库的备份和恢复1.备份2.还原 一.创建和删除数据库 说明&#xff1a; 1.大写的表示关键字 2.[] 是可选项 3.CHARACTER SET: 指定数据库采用的字符集 4.COLLATE: 指定数据库字符集的校验规则首先进入MySQL 创…

HTML程序大全(1):简易计算器

HTML代码&#xff0c;主要创建了几个按钮。 <div class"container"><div class"output" id"output">0</div><button class"button" onclick"clearOutput()" id"clear">C</button>…

猿人学第一题 js混淆 双重加密(详解)

当我们点击分页的时候可以确定这个请求过程是ajax请求&#xff0c;所以直接使用抓包工具找到储存信息的请求。 找到这个请求之后&#xff0c;我们明显发现?后面的参数m是一个加密过的 由于这个请求属于ajax请求&#xff0c;现在我们可以直接使用xhr断点调试找到位置 打上断电…

EP15:动态内存管理概述(c语言)malloc,calloc,realloc函数的介绍使用及柔性数组的介绍

如果学习方向是c方向那么c语言有三个板块的知识是非常重要的. 1:指针 2:结构体 3;动态内存管理. 序言:在c语言中,什么是动态内存 C语言中的动态内存是指在程序运行时&#xff0c;根据需要动态地分配内存空间的一种内存管理方式。与静态内存相比&#xff0c;动态内存的大小和生…

栈和队列面试题

文章目录 栈(1)逆波兰表达式求值(2)有效的括号(3)栈的压入、弹出序列(4)最小栈 队列(1)用栈实现队列(2)用队列实现栈(3)设计循环队列 栈 (1)逆波兰表达式求值 oj链接 给你一个字符串数组 tokens &#xff0c;表示一个根据 逆波兰表示法 表示的算术表达式。 请你计算该表达式…

C语言中文网C++学习笔记

目录 类也是一种构造类型&#xff0c;不但可以是变量&#xff0c;还可以是函数。解决合作开发时的命名冲突问题&#xff0c;C 引入了命名空间&#xff08;Namespace&#xff09;在C语言中&#xff0c;动态分配内存用 malloc() 函数&#xff0c;释放内存用 free() 函数。函数调用…

c语言:理解和避免野指针

野指针的定义&#xff1a; 野指针是指一个指针变量存储了一个无效的地址&#xff0c;通常是一个未初始化的指针或者指向已经被释放的内存地址。当程序尝试使用野指针时&#xff0c;可能会导致程序崩溃、内存泄漏或者其他不可预测的行为。因此&#xff0c;在编程中需要特别注意…

OpenCL不支持C++内核语言(设备语言)

在*.cl文件&#xff08;或字符串&#xff09;中不支持用class、template等&#xff01; 在*.cl文件&#xff08;或字符串&#xff09;中不支持给struct定义构造函数或成员函数&#xff01; 在*.cl文件&#xff08;或字符串&#xff09;中不支持函数默认参数&#xff0c;例如&…